UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 03:16:54";
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 programsettings SET companyname = 'سنتر احمد العربي', address = 'ش الترعة البولاقيه - امام قسم شبرا - مول العتبه', specializtion = 'ملابس جملة', phone = '01064062900', faxnumber = '', email = '', website = '', logo = '4a754be7e82553f312ecf932e16cce7d.jpg', 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` = '0', taxcard = '', commercialregistration = '', costcenter = '1', clinic = '1', workshop = '1', transport = '1', manufacturing = '1', masterCopy = '0' , dailyentrydate = '2020-04-18' ,updatefiledate = '2026-10-08',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='',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='83b7fcbc8ec5f6680b38c85c5097af3b8f9e24beb34e300c92da2aed73200ef3508d6b04b93e1301b69bf990665657d386b98aa70faa9951dfc2289ed943c6cd',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 user SET loginip = "" WHERE lastactivetime < "2026-10-09 04:38:55";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 08:08:55", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 08:08:55', '2', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5458
UPDATE programsettings SET companyname = 'سنتر احمد العربي', address = 'ش الترعة البولاقيه - امام قسم شبرا - مول العتبه', specializtion = 'ملابس جملة', phone = '01064062900', faxnumber = '', email = '', website = '', logo = '4a754be7e82553f312ecf932e16cce7d.jpg', 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` = '0', taxcard = '', commercialregistration = '', costcenter = '1', clinic = '1', workshop = '1', transport = '1', manufacturing = '1', masterCopy = '0' , dailyentrydate = '2020-04-18' ,updatefiledate = '2026-10-09',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='',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='83b7fcbc8ec5f6680b38c85c5097af3b8f9e24beb34e300c92da2aed73200ef3508d6b04b93e1301b69bf990665657d386b98aa70faa9951dfc2289ed943c6cd',associatedtags='0',commentClientChasis='0',dollarExType='64',saudielectronicinvoice='0',saudielectronicinvoclient='0',productDiscount='0'
                ,reviewRecords='',reviewRecordsLastDate='0000-00-00',showepayrestaurant='0',showSellAllPriceInStoreDetail='0' WHERE programsettingsid = '1';
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 04:38:55";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 08:08:55", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 08:08:55', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5459
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 04:39:00";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 08:09:00", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 08:09:00', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5460
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 04:54:01";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 04:54:12";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 08:24:12", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 08:24:12', '4', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5461
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 04:54:12";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 08:24:12", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 08:24:12', '4', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5462
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 04:54:14";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 08:24:14", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 08:24:14', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5463
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:11:40";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 08:41:40", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 08:41:40', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5464

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac876ec4e06e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 08:41:40', '06ac876ec4e06e', '1', '0.00', '0', '0', '1', '2895.00', '2895', '2895', '0', '1', '2026-10-09 08:41:40', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '9' ,'0','','','','','-1','0','0','0','0','0','2895','0','','0','0','2895','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=249
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','249', '0', '2026-10-09 08:41:40', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2895', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 08:41:40','0','0','',''); -- id=356
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 500;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('288.3','01655', '249', '125', '1655', '6', '310', '1860', '0', '', '0', '2026-10-09 08:41:40', '1655', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','500-6,','1','1','0','0','310','1860','0','','0','0.00','0','0','0','0'); -- id=941
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 288.30, meanbuyprice_withDiscount = 288.30
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 288.3
                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 (1655, '2026-10-09', 1860, 1860, 1860
                    , 1860, 1729.8, 1729.8, 1729.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1860, 1860, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1860, sellCostBuyPrice =sellCostBuyPrice+1860
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1860, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1860
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1729.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1729.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1729.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1860
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1860
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1860, 1860, 1860
                    , 1860, 1729.8, 1729.8, 1729.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1860, 1860, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1860, sellCostBuyPrice =sellCostBuyPrice+1860
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1860, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1860
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1729.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1729.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1729.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1860
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1860
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '174', userid = '2', storedetaildate = '2026-10-09 08:41:40' WHERE storedetailid = '2667';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1655', '1', '6', '1', '249', 'اضافة فاتورة مبيعات', 'sellbillController.php', '180', '174', '2', '2026-10-09 08:41:40','0','0'); -- id=3773
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 504;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320.85','01658', '249', '125', '1658', '3', '345', '1035', '0', '', '0', '2026-10-09 08:41:40', '1658', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','504-3,','1','1','0','0','345','1035','0','','0','0.00','0','0','0','0'); -- id=942
UPDATE sellbilldetail SET  lastbuyprice = 345.00 , meanbuyprice = 345.00, lastbuyprice_withDiscount = 320.85, meanbuyprice_withDiscount = 320.85
        , lastbuyprice_withTax = 345, meanbuyprice_withTax = 345, lastbuyprice_withDiscountAndTax = 320.85
                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 (1658, '2026-10-09', 1035, 1035, 1035
                    , 1035, 962.55, 962.55, 962.55
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1035, 1035, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1035, sellCostBuyPrice =sellCostBuyPrice+1035
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1035, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1035
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+962.55, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+962.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+962.55
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1035
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1035
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1035, 1035, 1035
                    , 1035, 962.55, 962.55, 962.55
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1035, 1035, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1035, sellCostBuyPrice =sellCostBuyPrice+1035
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1035, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1035
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+962.55, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+962.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+962.55
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1035
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1035
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '105', userid = '2', storedetaildate = '2026-10-09 08:41:40' WHERE storedetailid = '2670';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1658', '1', '3', '1', '249', 'اضافة فاتورة مبيعات', 'sellbillController.php', '108', '105', '2', '2026-10-09 08:41:40','0','0'); -- id=3774
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1353185',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1350290','2895', '0', '2', 'اضافة فاتورة مبيعات', '249', '1353185', '2026-10-09 08:41:40', '2',  'sellbillController.php','1','','0'); -- id=294
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2895', '2895', '2026-10-09', '2', '0', '0', '2026-10-09 08:41:40','اضافة فاتورة مبيعات رقم 249','1','0',null,'0','249','sellbillController.php?do=showDetail&sellbillid=249'); -- id=1619
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1619', '419', '2895', '','0'); -- id=1640
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1353185', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1619', '143', '2895', '','0'); -- id=1619
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2676925', 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 ( '2692.35', '2692.35', '2026-10-09', '2', '0', '0', '2026-10-09 08:41:40','اضافة فاتورة مبيعات رقم 249 - صرف البضاعة من المخزن','1','0',null,'0','249','sellbillController.php?do=showDetail&sellbillid=249'); -- id=1620
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1620', '402', '2692.35', '','0'); -- id=1641
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2529034.69', 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 ('1620', '382', '2692.35', '','0'); -- id=1620
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20159083.51', 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='1619,0,1620' where sellbillid=249;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 2895, 2895, 2895
                    , 2895, 2692.35, 2692.35, 2692.35
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2895, 2895, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2895, sellCostBuyPrice =sellCostBuyPrice+2895
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2895, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2895
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2692.35, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2692.35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2692.35
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2895
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2895
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2895, 2895, 2895
                    , 2895, 2692.35, 2692.35, 2692.35
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2895, 2895, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2895, sellCostBuyPrice =sellCostBuyPrice+2895
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2895, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2895
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2692.35, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2692.35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2692.35
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2895
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2895
                        , returnSellVal = returnSellVal+0, 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, 2895, 2895, 2895
                    , 2895, 2692.35, 2692.35, 2692.35, 2895, 2895)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2895, netSellCostBuyPrice = netSellCostBuyPrice+2895
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2895
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2895
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2692.35
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2692.35
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2692.35
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2895
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2895;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac876ec4e06e and sellbillId = 249 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:11:40";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 08:41:40", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 08:41:40', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5465
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:19:41";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:19:41";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:19:45";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 08:49:45", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 08:49:45', '6', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5466
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:19:45";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 08:49:45", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 08:49:45', '6', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5467
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:19:48";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 08:49:48", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 08:49:48', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5468
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:20:46";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 08:50:46", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 08:50:46', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5469

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac87e94c75b2
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 08:50:46', '06ac87e94c75b2', '1', '0.00', '0', '110', '1', '17610.00', '17500', '17500', '0', '1', '2026-10-09 08:50:46', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '45' ,'0','','','','','-1','0','0','0','0','0','17500','0','','0','0','17500','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=250
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','250', '0', '2026-10-09 08:50:46', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '17500', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 08:50:46','0','0','',''); -- id=357
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 556;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('404.8','01692', '250', '126', '1692', '12', '440', '5280', '0', '', '0', '2026-10-09 08:50:46', '1692', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','556-12,','1','1','0','0','440','5280','0','','0','0.00','0','0','0','0'); -- id=943
UPDATE sellbilldetail SET  lastbuyprice = 440.00 , meanbuyprice = 440.00, lastbuyprice_withDiscount = 404.80, meanbuyprice_withDiscount = 404.80
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 404.8
                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 (1692, '2026-10-09', 5247.0187393526, 5280, 5280
                    , 5280, 4857.6, 4857.6, 4857.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 5280, 5280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5247.0187393526, sellCostBuyPrice =sellCostBuyPrice+5280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4857.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4857.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4857.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5247.0187393526, 5280, 5280
                    , 5280, 4857.6, 4857.6, 4857.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5280, 5280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5247.0187393526, sellCostBuyPrice =sellCostBuyPrice+5280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4857.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4857.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4857.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '2', storedetaildate = '2026-10-09 08:50:46' WHERE storedetailid = '2704';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1692', '1', '12', '1', '250', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '12', '2', '2026-10-09 08:50:46','0','0'); -- id=3775
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 503;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('334.8','01657', '250', '125', '1657', '3', '360', '1080', '0', '', '0', '2026-10-09 08:50:46', '1657', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','503-3,','1','1','0','0','360','1080','0','','0','0.00','0','0','0','0'); -- id=944
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 334.80, meanbuyprice_withDiscount = 334.80
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 334.8
                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 (1657, '2026-10-09', 1073.2538330494, 1080, 1080
                    , 1080, 1004.4, 1004.4, 1004.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1073.2538330494, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1004.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1004.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1004.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1073.2538330494, 1080, 1080
                    , 1080, 1004.4, 1004.4, 1004.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1073.2538330494, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1004.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1004.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1004.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '171', userid = '2', storedetaildate = '2026-10-09 08:50:46' WHERE storedetailid = '2669';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1657', '1', '3', '1', '250', 'اضافة فاتورة مبيعات', 'sellbillController.php', '174', '171', '2', '2026-10-09 08:50:46','0','0'); -- id=3776
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 505;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('362.7','01659', '250', '125', '1659', '12', '390', '4680', '0', '', '0', '2026-10-09 08:50:46', '1659', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','505-12,','1','1','0','0','390','4680','0','','0','0.00','0','0','0','0'); -- id=945
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 362.70, meanbuyprice_withDiscount = 362.70
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 362.7
                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 (1659, '2026-10-09', 4650.7666098807, 4680, 4680
                    , 4680, 4352.4, 4352.4, 4352.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4680, 4680, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4650.7666098807, sellCostBuyPrice =sellCostBuyPrice+4680
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4680, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4680
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4352.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4352.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4352.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4680
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4680
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4650.7666098807, 4680, 4680
                    , 4680, 4352.4, 4352.4, 4352.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4680, 4680, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4650.7666098807, sellCostBuyPrice =sellCostBuyPrice+4680
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4680, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4680
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4352.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4352.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4352.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4680
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4680
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '222', userid = '2', storedetaildate = '2026-10-09 08:50:46' WHERE storedetailid = '2671';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1659', '1', '12', '1', '250', 'اضافة فاتورة مبيعات', 'sellbillController.php', '234', '222', '2', '2026-10-09 08:50:46','0','0'); -- id=3777
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 235;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01456', '250', '94', '1456', '9', '360', '3240', '0', '', '0', '2026-10-09 08:50:46', '1456', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','235-9,','1','1','0','0','360','3240','0','','0','0.00','0','0','0','0'); -- id=946
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                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 (1456, '2026-10-09', 3219.7614991482, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3219.7614991482, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3219.7614991482, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3219.7614991482, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '231', userid = '2', storedetaildate = '2026-10-09 08:50:46' WHERE storedetailid = '1481';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1456', '1', '9', '1', '250', 'اضافة فاتورة مبيعات', 'sellbillController.php', '240', '231', '2', '2026-10-09 08:50:46','0','0'); -- id=3778
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 297;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('333','01519', '250', '111', '1519', '9', '370', '3330', '0', '', '0', '2026-10-09 08:50:46', '1519', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','297-9,','1','1','0','0','370','3330','0','','0','0.00','0','0','0','0'); -- id=947
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 333.00, meanbuyprice_withDiscount = 333.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 333
                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 (1519, '2026-10-09', 3309.199318569, 3330, 3330
                    , 3330, 2997, 2997, 2997
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3330, 3330, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3309.199318569, sellCostBuyPrice =sellCostBuyPrice+3330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2997, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2997
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2997
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3330
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3330
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3309.199318569, 3330, 3330
                    , 3330, 2997, 2997, 2997
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3330, 3330, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3309.199318569, sellCostBuyPrice =sellCostBuyPrice+3330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2997, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2997
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2997
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3330
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3330
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '2', storedetaildate = '2026-10-09 08:50:46' WHERE storedetailid = '1544';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1519', '1', '9', '1', '250', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '21', '2', '2026-10-09 08:50:46','0','0'); -- id=3779
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1370685',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1353185','17500', '0', '2', 'اضافة فاتورة مبيعات', '250', '1370685', '2026-10-09 08:50:46', '2',  'sellbillController.php','1','','0'); -- id=295
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '17610', '17610', '2026-10-09', '2', '0', '0', '2026-10-09 08:50:46','اضافة فاتورة مبيعات رقم 250','1','0',null,'0','250','sellbillController.php?do=showDetail&sellbillid=250'); -- id=1621
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1621', '419', '17500', '','0'); -- id=1642
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1370685', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1621', '398', '110', '','0'); -- id=1643
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '137163', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1621', '143', '17610', '','0'); -- id=1621
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2694535', 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 ( '16091.4', '16091.4', '2026-10-09', '2', '0', '0', '2026-10-09 08:50:46','اضافة فاتورة مبيعات رقم 250 - صرف البضاعة من المخزن','1','0',null,'0','250','sellbillController.php?do=showDetail&sellbillid=250'); -- id=1622
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1622', '402', '16091.4', '','0'); -- id=1644
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2545126.09', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1622', '382', '16091.4', '','0'); -- id=1622
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20142992.11', 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='1621,0,1622' where sellbillid=250;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 17500, 17250, 17250
                    , 17250, 16091.4, 16091.4, 16091.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,17250, 17250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17500, sellCostBuyPrice =sellCostBuyPrice+17250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+17250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+17250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+16091.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+16091.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+16091.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+17250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+17250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 17500, 17250, 17250
                    , 17250, 16091.4, 16091.4, 16091.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,17250, 17250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17500, sellCostBuyPrice =sellCostBuyPrice+17250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+17250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+17250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+16091.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+16091.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+16091.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+17250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+17250
                        , returnSellVal = returnSellVal+0, 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, 17500, 17250, 17250
                    , 17250, 16091.4, 16091.4, 16091.4, 17250, 17250)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+17500, netSellCostBuyPrice = netSellCostBuyPrice+17250
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+17250
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+17250
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+16091.4
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+16091.4
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+16091.4
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+17250
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+17250;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac87e94c75b2 and sellbillId = 250 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:20:46";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 08:50:46", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 08:50:46', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5470
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 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 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 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 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 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 blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:26:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 08:56:32", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 08:56:32', '6', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5471

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8807c8af76
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 08:56:32', '06ac8807c8af76', '1', '0.00', '0', '0', '1', '13230.00', '13230', '13230', '0', '1', '2026-10-09 08:56:32', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '18' ,'0','','','','','-1','0','0','0','0','0','13230','0','','0','0','13230','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=251
UPDATE client SET  clientdebt = '0', userid = '6' 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','اضافة فاتورة مبيعات','251', '0', '2026-10-09 08:56:32', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '13230', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 08:56:32','0','0','',''); -- id=358
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 292;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('690','01514', '251', '109', '1514', '9', '720', '6480', '0', '', '0', '2026-10-09 08:56:32', '1514', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','292-9,','1','1','0','0','720','6480','0','','0','0.00','0','0','0','0'); -- id=948
UPDATE sellbilldetail SET  lastbuyprice = 690.00 , meanbuyprice = 690.00, lastbuyprice_withDiscount = 690.00, meanbuyprice_withDiscount = 690.00
        , lastbuyprice_withTax = 690, meanbuyprice_withTax = 690, lastbuyprice_withDiscountAndTax = 690
                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 (1514, '2026-10-09', 6480, 6210, 6210
                    , 6210, 6210, 6210, 6210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 6210, 6210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6480, sellCostBuyPrice =sellCostBuyPrice+6210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6210
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 6480, 6210, 6210
                    , 6210, 6210, 6210, 6210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6210, 6210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6480, sellCostBuyPrice =sellCostBuyPrice+6210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6210
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '6', storedetaildate = '2026-10-09 08:56:32' WHERE storedetailid = '1539';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1514', '1', '9', '1', '251', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '21', '6', '2026-10-09 08:56:32','0','0'); -- id=3780
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 287;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('720','01509', '251', '109', '1509', '9', '750', '6750', '0', '', '0', '2026-10-09 08:56:32', '1509', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','287-9,','1','1','0','0','750','6750','0','','0','0.00','0','0','0','0'); -- id=949
UPDATE sellbilldetail SET  lastbuyprice = 720.00 , meanbuyprice = 720.00, lastbuyprice_withDiscount = 720.00, meanbuyprice_withDiscount = 720.00
        , lastbuyprice_withTax = 720, meanbuyprice_withTax = 720, lastbuyprice_withDiscountAndTax = 720
                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 (1509, '2026-10-09', 6750, 6480, 6480
                    , 6480, 6480, 6480, 6480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 6480, 6480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6750, sellCostBuyPrice =sellCostBuyPrice+6480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 6750, 6480, 6480
                    , 6480, 6480, 6480, 6480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6480, 6480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6750, sellCostBuyPrice =sellCostBuyPrice+6480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '6', storedetaildate = '2026-10-09 08:56:32' WHERE storedetailid = '1534';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1509', '1', '9', '1', '251', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '15', '6', '2026-10-09 08:56:32','0','0'); -- id=3781
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '13230',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('0','13230', '0', '4', 'اضافة فاتورة مبيعات', '251', '13230', '2026-10-09 08:56:32', '6',  'sellbillController.php','1','','0'); -- id=296
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '13230', '13230', '2026-10-09', '6', '0', '0', '2026-10-09 08:56:32','اضافة فاتورة مبيعات رقم 251','1','0',null,'0','251','sellbillController.php?do=showDetail&sellbillid=251'); -- id=1623
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1623', '568', '13230', '','0'); -- id=1645
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '13230', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1623', '143', '13230', '','0'); -- id=1623
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2707765', 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 ( '12690', '12690', '2026-10-09', '6', '0', '0', '2026-10-09 08:56:32','اضافة فاتورة مبيعات رقم 251 - صرف البضاعة من المخزن','1','0',null,'0','251','sellbillController.php?do=showDetail&sellbillid=251'); -- id=1624
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1624', '402', '12690', '','0'); -- id=1646
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2557816.09', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1624', '382', '12690', '','0'); -- id=1624
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20130302.11', 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='1623,0,1624' where sellbillid=251;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 13230, 12690, 12690
                    , 12690, 12690, 12690, 12690
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12690, 12690, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13230, sellCostBuyPrice =sellCostBuyPrice+12690
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12690, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12690
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12690, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12690
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12690
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12690
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12690
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 13230, 12690, 12690
                    , 12690, 12690, 12690, 12690
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12690, 12690, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13230, sellCostBuyPrice =sellCostBuyPrice+12690
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12690, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12690
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12690, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12690
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12690
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12690
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12690
                        , returnSellVal = returnSellVal+0, 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, 13230, 12690, 12690
                    , 12690, 12690, 12690, 12690, 12690, 12690)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+13230, netSellCostBuyPrice = netSellCostBuyPrice+12690
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+12690
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+12690
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+12690
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+12690
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+12690
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+12690
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+12690;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8807c8af76 and sellbillId = 251 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:26:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 08:56:32", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 08:56:32', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5472
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 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 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 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 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 blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:29:31";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 08:59:31", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 08:59:31', '3', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5473
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:29:32";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 08:59:32', '3', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5474
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:30:12";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:00:12", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 09:00:12', '3', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5475
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:30:12";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 09:00:12', '3', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5476
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:30:24";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:00:24", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:00:24', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5477
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:30:24";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:00:24", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:00:24', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5478
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:30:45";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:00:45", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:00:46', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5479
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:30:46";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:00:46", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:00:46', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5480
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 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 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 blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:31:58";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:01:58", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 09:01:58', '3', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5481
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:31:58";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 09:01:58', '3', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5482
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:32:10";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:02:10", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:02:10', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5483
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:33:39";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:03:39", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:03:39', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5484

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac880b674c3d
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:03:39', '06ac880b674c3d', '1', '0.00', '0', '0', '1', '23260.00', '23260', '23260', '0', '1', '2026-10-09 09:03:39', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '61' ,'0','','','','','-1','0','0','0','0','0','23260','0','','0','0','23260','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=252
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','252', '0', '2026-10-09 09:03:39', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '23260', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:03:39','0','0','',''); -- id=359
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 76;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('441','01384', '252', '95', '1384', '9', '490', '4410', '0', '', '0', '2026-10-09 09:03:39', '1384', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','76-9,','1','1','0','0','490','4410','0','','0','0.00','0','0','0','0'); -- id=950
UPDATE sellbilldetail SET  lastbuyprice = 490.00 , meanbuyprice = 490.00, lastbuyprice_withDiscount = 441.00, meanbuyprice_withDiscount = 465.50
        , lastbuyprice_withTax = 490, meanbuyprice_withTax = 245, lastbuyprice_withDiscountAndTax = 441
                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 (1384, '2026-10-09', 4410, 4410, 4410
                    , 4410, 3969, 4189.5, 3969
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4410, 2205, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4410, sellCostBuyPrice =sellCostBuyPrice+4410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3969, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4189.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3969
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4410
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2205
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4410, 4410, 4410
                    , 4410, 3969, 4189.5, 3969
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4410, 2205, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4410, sellCostBuyPrice =sellCostBuyPrice+4410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3969, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4189.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3969
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4410
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2205
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '288', userid = '2', storedetaildate = '2026-10-09 09:03:39' WHERE storedetailid = '1384';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1384', '1', '9', '1', '252', 'اضافة فاتورة مبيعات', 'sellbillController.php', '297', '288', '2', '2026-10-09 09:03:39','0','0'); -- id=3782
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 501;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('344.1','01656', '252', '125', '1656', '9', '370', '3330', '0', '', '0', '2026-10-09 09:03:39', '1656', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','501-9,','1','1','0','0','370','3330','0','','0','0.00','0','0','0','0'); -- id=951
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 344.10, meanbuyprice_withDiscount = 344.10
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 344.1
                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 (1656, '2026-10-09', 3330, 3330, 3330
                    , 3330, 3096.9, 3096.9, 3096.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3330, 3330, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3330, sellCostBuyPrice =sellCostBuyPrice+3330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3096.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3096.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3096.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3330
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3330
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3330, 3330, 3330
                    , 3330, 3096.9, 3096.9, 3096.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3330, 3330, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3330, sellCostBuyPrice =sellCostBuyPrice+3330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3096.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3096.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3096.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3330
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3330
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '123', userid = '2', storedetaildate = '2026-10-09 09:03:39' WHERE storedetailid = '2668';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1656', '1', '9', '1', '252', 'اضافة فاتورة مبيعات', 'sellbillController.php', '132', '123', '2', '2026-10-09 09:03:39','0','0'); -- id=3783
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 505;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('362.7','01659', '252', '125', '1659', '9', '390', '3510', '0', '', '0', '2026-10-09 09:03:39', '1659', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','505-9,','1','1','0','0','390','3510','0','','0','0.00','0','0','0','0'); -- id=952
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 362.70, meanbuyprice_withDiscount = 362.70
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 362.7
                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 (1659, '2026-10-09', 3510, 3510, 3510
                    , 3510, 3264.3, 3264.3, 3264.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3510, 3510, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3510, sellCostBuyPrice =sellCostBuyPrice+3510
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3510, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3510
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3264.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3264.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3264.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3510
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3510
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3510, 3510, 3510
                    , 3510, 3264.3, 3264.3, 3264.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3510, 3510, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3510, sellCostBuyPrice =sellCostBuyPrice+3510
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3510, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3510
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3264.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3264.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3264.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3510
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3510
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '213', userid = '2', storedetaildate = '2026-10-09 09:03:39' WHERE storedetailid = '2671';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1659', '1', '9', '1', '252', 'اضافة فاتورة مبيعات', 'sellbillController.php', '222', '213', '2', '2026-10-09 09:03:39','0','0'); -- id=3784
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 503;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('334.8','01657', '252', '125', '1657', '9', '360', '3240', '0', '', '0', '2026-10-09 09:03:39', '1657', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','503-9,','1','1','0','0','360','3240','0','','0','0.00','0','0','0','0'); -- id=953
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 334.80, meanbuyprice_withDiscount = 334.80
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 334.8
                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 (1657, '2026-10-09', 3240, 3240, 3240
                    , 3240, 3013.2, 3013.2, 3013.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3240, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3013.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3013.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3013.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3240, 3240, 3240
                    , 3240, 3013.2, 3013.2, 3013.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3240, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3013.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3013.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3013.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '162', userid = '2', storedetaildate = '2026-10-09 09:03:39' WHERE storedetailid = '2669';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1657', '1', '9', '1', '252', 'اضافة فاتورة مبيعات', 'sellbillController.php', '171', '162', '2', '2026-10-09 09:03:39','0','0'); -- id=3785
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 501;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('344.1','01656', '252', '125', '1656', '9', '370', '3330', '0', '', '0', '2026-10-09 09:03:39', '1656', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','501-9,','1','1','0','0','370','3330','0','','0','0.00','0','0','0','0'); -- id=954
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 344.10, meanbuyprice_withDiscount = 344.10
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 344.1
                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 (1656, '2026-10-09', 3330, 3330, 3330
                    , 3330, 3096.9, 3096.9, 3096.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3330, 3330, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3330, sellCostBuyPrice =sellCostBuyPrice+3330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3096.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3096.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3096.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3330
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3330
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3330, 3330, 3330
                    , 3330, 3096.9, 3096.9, 3096.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3330, 3330, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3330, sellCostBuyPrice =sellCostBuyPrice+3330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3096.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3096.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3096.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3330
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3330
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '114', userid = '2', storedetaildate = '2026-10-09 09:03:39' WHERE storedetailid = '2668';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1656', '1', '9', '1', '252', 'اضافة فاتورة مبيعات', 'sellbillController.php', '123', '114', '2', '2026-10-09 09:03:39','0','0'); -- id=3786
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+16 where id = 355;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('276','01467', '252', '104', '1467', '16', '340', '5440', '0', '', '0', '2026-10-09 09:03:39', '1467', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','355-16,','1','1','0','0','340','5440','0','','0','0.00','0','0','0','0'); -- id=955
UPDATE sellbilldetail SET  lastbuyprice = 276.00 , meanbuyprice = 276.00, lastbuyprice_withDiscount = 276.00, meanbuyprice_withDiscount = 276.00
        , lastbuyprice_withTax = 276, meanbuyprice_withTax = 276, lastbuyprice_withDiscountAndTax = 276
                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 (1467, '2026-10-09', 5440, 4416, 4416
                    , 4416, 4416, 4416, 4416
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 4416, 4416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5440, sellCostBuyPrice =sellCostBuyPrice+4416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4416, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4416
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5440, 4416, 4416
                    , 4416, 4416, 4416, 4416
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4416, 4416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5440, sellCostBuyPrice =sellCostBuyPrice+4416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4416, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4416
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '768', userid = '2', storedetaildate = '2026-10-09 09:03:39' WHERE storedetailid = '1492';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1467', '1', '16', '1', '252', 'اضافة فاتورة مبيعات', 'sellbillController.php', '784', '768', '2', '2026-10-09 09:03:39','0','0'); -- id=3787
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1393945',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1370685','23260', '0', '2', 'اضافة فاتورة مبيعات', '252', '1393945', '2026-10-09 09:03:39', '2',  'sellbillController.php','1','','0'); -- id=297
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '23260', '23260', '2026-10-09', '2', '0', '0', '2026-10-09 09:03:39','اضافة فاتورة مبيعات رقم 252','1','0',null,'0','252','sellbillController.php?do=showDetail&sellbillid=252'); -- id=1625
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1625', '419', '23260', '','0'); -- id=1647
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1393945', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1625', '143', '23260', '','0'); -- id=1625
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2731025', 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 ( '20856.3', '20856.3', '2026-10-09', '2', '0', '0', '2026-10-09 09:03:39','اضافة فاتورة مبيعات رقم 252 - صرف البضاعة من المخزن','1','0',null,'0','252','sellbillController.php?do=showDetail&sellbillid=252'); -- id=1626
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1626', '402', '20856.3', '','0'); -- id=1648
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2578672.39', 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 ('1626', '382', '20856.3', '','0'); -- id=1626
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20109445.81', 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='1625,0,1626' where sellbillid=252;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 23260, 22236, 22236
                    , 22236, 20856.3, 21076.8, 20856.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,22236, 20031, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23260, sellCostBuyPrice =sellCostBuyPrice+22236
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22236, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22236
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20856.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+21076.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20856.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22236
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20031
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 23260, 22236, 22236
                    , 22236, 20856.3, 21076.8, 20856.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,22236, 20031, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23260, sellCostBuyPrice =sellCostBuyPrice+22236
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22236, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22236
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20856.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+21076.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20856.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22236
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20031
                        , returnSellVal = returnSellVal+0, 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, 23260, 22236, 22236
                    , 22236, 20856.3, 21076.8, 20856.3, 22236, 20031)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+23260, netSellCostBuyPrice = netSellCostBuyPrice+22236
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+22236
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+22236
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+20856.3
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+21076.8
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+20856.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+22236
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+20031;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac880b674c3d and sellbillId = 252 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:33:40";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:03:40", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:03:40', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5485
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:38:25";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:08:25", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:08:25', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5486

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac88362d241f
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:08:26', '06ac88362d241f', '1', '0.00', '0', '30', '1', '27130.00', '27100', '27100', '0', '1', '2026-10-09 09:08:26', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '59' ,'0','','','','','-1','0','0','0','0','0','27100','0','','0','0','27100','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=253
UPDATE client SET  clientdebt = '0', userid = '3' 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','اضافة فاتورة مبيعات','253', '0', '2026-10-09 09:08:26', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '27100', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:08:26','0','0','',''); -- id=360
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 513;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('533.6','01664', '253', '124', '1664', '9', '580', '5220', '0', '', '0', '2026-10-09 09:08:26', '1664', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','513-9,','1','1','0','0','580','5220','0','','0','','0','0','0','0'); -- id=956
UPDATE sellbilldetail SET  lastbuyprice = 580.00 , meanbuyprice = 580.00, lastbuyprice_withDiscount = 533.60, meanbuyprice_withDiscount = 533.60
        , lastbuyprice_withTax = 580, meanbuyprice_withTax = 580, lastbuyprice_withDiscountAndTax = 533.6
                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 (1664, '2026-10-09', 5214.2277921121, 5220, 5220
                    , 5220, 4802.4, 4802.4, 4802.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 5220, 5220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5214.2277921121, sellCostBuyPrice =sellCostBuyPrice+5220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4802.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4802.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4802.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5214.2277921121, 5220, 5220
                    , 5220, 4802.4, 4802.4, 4802.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5220, 5220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5214.2277921121, sellCostBuyPrice =sellCostBuyPrice+5220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4802.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4802.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4802.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '3', storedetaildate = '2026-10-09 09:08:26' WHERE storedetailid = '2676';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1664', '1', '9', '1', '253', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '12', '3', '2026-10-09 09:08:26','0','0'); -- id=3788
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 516;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('437','01667', '253', '124', '1667', '9', '475', '4275', '0', '', '0', '2026-10-09 09:08:26', '1667', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','516-9,','1','1','0','0','475','4275','0','','0','','0','0','0','0'); -- id=957
UPDATE sellbilldetail SET  lastbuyprice = 475.00 , meanbuyprice = 475.00, lastbuyprice_withDiscount = 437.00, meanbuyprice_withDiscount = 437.00
        , lastbuyprice_withTax = 475, meanbuyprice_withTax = 475, lastbuyprice_withDiscountAndTax = 437
                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 (1667, '2026-10-09', 4270.2727607814, 4275, 4275
                    , 4275, 3933, 3933, 3933
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4275, 4275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4270.2727607814, sellCostBuyPrice =sellCostBuyPrice+4275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3933, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3933
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3933
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4270.2727607814, 4275, 4275
                    , 4275, 3933, 3933, 3933
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4275, 4275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4270.2727607814, sellCostBuyPrice =sellCostBuyPrice+4275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3933, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3933
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3933
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 09:08:26' WHERE storedetailid = '2679';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1667', '1', '9', '1', '253', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '9', '3', '2026-10-09 09:08:26','0','0'); -- id=3789
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 519;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('496.8','01670', '253', '124', '1670', '6', '540', '3240', '0', '', '0', '2026-10-09 09:08:26', '1670', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','519-6,','1','1','0','0','540','3240','0','','0','','0','0','0','0'); -- id=958
UPDATE sellbilldetail SET  lastbuyprice = 540.00 , meanbuyprice = 540.00, lastbuyprice_withDiscount = 496.80, meanbuyprice_withDiscount = 496.80
        , lastbuyprice_withTax = 540, meanbuyprice_withTax = 540, lastbuyprice_withDiscountAndTax = 496.8
                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 (1670, '2026-10-09', 3236.4172502764, 3240, 3240
                    , 3240, 2980.8, 2980.8, 2980.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3236.4172502764, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2980.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2980.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2980.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3236.4172502764, 3240, 3240
                    , 3240, 2980.8, 2980.8, 2980.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3236.4172502764, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2980.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2980.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2980.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 09:08:26' WHERE storedetailid = '2682';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1670', '1', '6', '1', '253', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '3', '3', '2026-10-09 09:08:26','0','0'); -- id=3790
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 546;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','01644', '253', '122', '1644', '6', '460', '2760', '0', '', '0', '2026-10-09 09:08:26', '1644', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','546-6,','1','1','0','0','460','2760','0','','0','','0','0','0','0'); -- id=959
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 414
                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 (1644, '2026-10-09', 2756.9480280133, 2760, 2760
                    , 2760, 2484, 2484, 2484
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2756.9480280133, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2484, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2484
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2484
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2756.9480280133, 2760, 2760
                    , 2760, 2484, 2484, 2484
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2756.9480280133, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2484, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2484
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2484
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 09:08:26' WHERE storedetailid = '1669';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1644', '1', '6', '1', '253', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '18', '3', '2026-10-09 09:08:26','0','0'); -- id=3791
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 370;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('637','01552', '253', '8', '1552', '5', '665', '3325', '0', '', '0', '2026-10-09 09:08:26', '1552', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','370-5,','1','1','0','0','665','3325','0','','0','','0','0','0','0'); -- id=960
UPDATE sellbilldetail SET  lastbuyprice = 637.00 , meanbuyprice = 637.00, lastbuyprice_withDiscount = 637.00, meanbuyprice_withDiscount = 637.00
        , lastbuyprice_withTax = 637, meanbuyprice_withTax = 637, lastbuyprice_withDiscountAndTax = 637
                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 (1552, '2026-10-09', 3321.3232583856, 3185, 3185
                    , 3185, 3185, 3185, 3185
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 3185, 3185, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3321.3232583856, sellCostBuyPrice =sellCostBuyPrice+3185
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3185
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3185
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3185
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3185
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3321.3232583856, 3185, 3185
                    , 3185, 3185, 3185, 3185
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3185, 3185, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3321.3232583856, sellCostBuyPrice =sellCostBuyPrice+3185
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3185
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3185
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3185
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3185
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '5', userid = '3', storedetaildate = '2026-10-09 09:08:26' WHERE storedetailid = '1577';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1552', '1', '5', '1', '253', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '5', '3', '2026-10-09 09:08:26','0','0'); -- id=3792
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 329;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','01459', '253', '103', '1459', '3', '330', '990', '0', '', '0', '2026-10-09 09:08:26', '1459', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','329-3,','1','1','0','0','330','990','0','','0','','0','0','0','0'); -- id=961
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 961;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1459, '2026-10-09', 988.9052709178, 930, 930
                    , 930, 930, 930, 930
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 930, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+988.9052709178, sellCostBuyPrice =sellCostBuyPrice+930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+930
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+930
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 988.9052709178, 930, 930
                    , 930, 930, 930, 930
                    , 0, 0, 0, 0
                    , 0, 0, 0, 930, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+988.9052709178, sellCostBuyPrice =sellCostBuyPrice+930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+930
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+930
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 09:08:26' WHERE storedetailid = '1484';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1459', '1', '3', '1', '253', 'اضافة فاتورة مبيعات', 'sellbillController.php', '46', '43', '3', '2026-10-09 09:08:26','0','0'); -- id=3793
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 503;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('334.8','01657', '253', '125', '1657', '9', '360', '3240', '0', '', '0', '2026-10-09 09:08:26', '1657', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','503-9,','1','1','0','0','360','3240','0','','0','','0','0','0','0'); -- id=962
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 334.80, meanbuyprice_withDiscount = 334.80
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 334.8
                where sellbilldetailid = 962;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1657, '2026-10-09', 3236.4172502764, 3240, 3240
                    , 3240, 3013.2, 3013.2, 3013.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3236.4172502764, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3013.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3013.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3013.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3236.4172502764, 3240, 3240
                    , 3240, 3013.2, 3013.2, 3013.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3236.4172502764, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3013.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3013.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3013.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '153', userid = '3', storedetaildate = '2026-10-09 09:08:26' WHERE storedetailid = '2669';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1657', '1', '9', '1', '253', 'اضافة فاتورة مبيعات', 'sellbillController.php', '162', '153', '3', '2026-10-09 09:08:26','0','0'); -- id=3794
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 355;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('276','01467', '253', '104', '1467', '12', '340', '4080', '0', '', '0', '2026-10-09 09:08:26', '1467', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','355-12,','1','1','0','0','340','4080','0','','0','','0','0','0','0'); -- id=963
UPDATE sellbilldetail SET  lastbuyprice = 276.00 , meanbuyprice = 276.00, lastbuyprice_withDiscount = 276.00, meanbuyprice_withDiscount = 276.00
        , lastbuyprice_withTax = 276, meanbuyprice_withTax = 276, lastbuyprice_withDiscountAndTax = 276
                where sellbilldetailid = 963;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1467, '2026-10-09', 4075.488389237, 3312, 3312
                    , 3312, 3312, 3312, 3312
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3312, 3312, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4075.488389237, sellCostBuyPrice =sellCostBuyPrice+3312
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3312, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3312
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3312, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3312
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3312
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3312
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3312
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4075.488389237, 3312, 3312
                    , 3312, 3312, 3312, 3312
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3312, 3312, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4075.488389237, sellCostBuyPrice =sellCostBuyPrice+3312
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3312, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3312
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3312, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3312
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3312
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3312
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3312
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '756', userid = '3', storedetaildate = '2026-10-09 09:08:26' WHERE storedetailid = '1492';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1467', '1', '12', '1', '253', 'اضافة فاتورة مبيعات', 'sellbillController.php', '768', '756', '3', '2026-10-09 09:08:26','0','0'); -- id=3795
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1421045',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1393945','27100', '0', '2', 'اضافة فاتورة مبيعات', '253', '1421045', '2026-10-09 09:08:26', '3',  'sellbillController.php','1','','0'); -- id=298
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '27130', '27130', '2026-10-09', '3', '0', '0', '2026-10-09 09:08:26','اضافة فاتورة مبيعات رقم 253','1','0',null,'0','253','sellbillController.php?do=showDetail&sellbillid=253'); -- id=1627
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1627', '419', '27100', '','0'); -- id=1649
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1421045', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1627', '398', '30', '','0'); -- id=1650
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '137193', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1627', '143', '27130', '','0'); -- id=1627
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2758155', 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 ( '24640.4', '24640.4', '2026-10-09', '3', '0', '0', '2026-10-09 09:08:26','اضافة فاتورة مبيعات رقم 253 - صرف البضاعة من المخزن','1','0',null,'0','253','sellbillController.php?do=showDetail&sellbillid=253'); -- id=1628
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1628', '402', '24640.4', '','0'); -- id=1651
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2603312.79', 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 ('1628', '382', '24640.4', '','0'); -- id=1628
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20084805.41', 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='1627,0,1628' where sellbillid=253;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 27100, 26162, 26162
                    , 26162, 24640.4, 24640.4, 24640.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,26162, 26162, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+27100, sellCostBuyPrice =sellCostBuyPrice+26162
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26162, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26162
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24640.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+24640.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+24640.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26162
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26162
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 27100, 26162, 26162
                    , 26162, 24640.4, 24640.4, 24640.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,26162, 26162, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+27100, sellCostBuyPrice =sellCostBuyPrice+26162
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26162, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26162
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24640.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+24640.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+24640.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26162
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26162
                        , returnSellVal = returnSellVal+0, 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, 27100, 26162, 26162
                    , 26162, 24640.4, 24640.4, 24640.4, 26162, 26162)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+27100, netSellCostBuyPrice = netSellCostBuyPrice+26162
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+26162
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+26162
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+24640.4
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+24640.4
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+24640.4
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+26162
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+26162;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac88362d241f and sellbillId = 253 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:38:26";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:08:26", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:08:26', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5487
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:38:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:08:32", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:08:32', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=253'); -- id=5488
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:38:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:08:32", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:08:32', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=253'); -- id=5489
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:41:13";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:11:13", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 09:11:13', '3', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5490
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:41:14";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:11:14", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 09:11:14', '3', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5491
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:41:20";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:11:20", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:11:20', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=253'); -- id=5492
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:41:55";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:11:55", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:11:55', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5493
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:41:55";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:11:55", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:11:55', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5494
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:42:01";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:12:01", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:12:01', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5495
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:42:06";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:12:06", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:12:06', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5496

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac883bc379e5
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:12:06', '06ac883bc379e5', '1', '0.00', '0', '0', '1', '14685.00', '14685', '14685', '0', '1', '2026-10-09 09:12:06', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '33' ,'0','','','','','-1','0','0','0','0','0','14685','0','','0','0','14685','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=254
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','254', '0', '2026-10-09 09:12:06', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '14685', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:12:06','0','0','',''); -- id=361
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 581;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('510','01718', '254', '131', '1718', '15', '535', '8025', '0', '', '0', '2026-10-09 09:12:06', '1718', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','581-15,','1','1','0','0','535','8025','0','','0','0.00','0','0','0','0'); -- id=964
UPDATE sellbilldetail SET  lastbuyprice = 510.00 , meanbuyprice = 510.00, lastbuyprice_withDiscount = 510.00, meanbuyprice_withDiscount = 510.00
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 510
                where sellbilldetailid = 964;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1718, '2026-10-09', 8025, 7650, 7650
                    , 7650, 7650, 7650, 7650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 7650, 7650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8025, sellCostBuyPrice =sellCostBuyPrice+7650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-10-09', 8025, 7650, 7650
                    , 7650, 7650, 7650, 7650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7650, 7650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8025, sellCostBuyPrice =sellCostBuyPrice+7650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '183', userid = '2', storedetaildate = '2026-10-09 09:12:06' WHERE storedetailid = '2730';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1718', '1', '15', '1', '254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '198', '183', '2', '2026-10-09 09:12:06','0','0'); -- id=3796
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+18 where id = 501;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('344.1','01656', '254', '125', '1656', '18', '370', '6660', '0', '', '0', '2026-10-09 09:12:06', '1656', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','501-18,','1','1','0','0','370','6660','0','','0','0.00','0','0','0','0'); -- id=965
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 344.10, meanbuyprice_withDiscount = 344.10
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 344.1
                where sellbilldetailid = 965;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1656, '2026-10-09', 6660, 6660, 6660
                    , 6660, 6193.8, 6193.8, 6193.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 0, 6660, 6660, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6660, sellCostBuyPrice =sellCostBuyPrice+6660
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6660, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6660
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6193.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6193.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6193.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6660
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6660
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+18
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 6660, 6660, 6660
                    , 6660, 6193.8, 6193.8, 6193.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6660, 6660, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6660, sellCostBuyPrice =sellCostBuyPrice+6660
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6660, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6660
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6193.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6193.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6193.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6660
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6660
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '96', userid = '2', storedetaildate = '2026-10-09 09:12:06' WHERE storedetailid = '2668';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1656', '1', '18', '1', '254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '114', '96', '2', '2026-10-09 09:12:06','0','0'); -- id=3797
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1435730',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1421045','14685', '0', '2', 'اضافة فاتورة مبيعات', '254', '1435730', '2026-10-09 09:12:06', '2',  'sellbillController.php','1','','0'); -- id=299
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '14685', '14685', '2026-10-09', '2', '0', '0', '2026-10-09 09:12:06','اضافة فاتورة مبيعات رقم 254','1','0',null,'0','254','sellbillController.php?do=showDetail&sellbillid=254'); -- id=1629
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1629', '419', '14685', '','0'); -- id=1652
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1435730', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1629', '143', '14685', '','0'); -- id=1629
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2772840', 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 ( '13843.8', '13843.8', '2026-10-09', '2', '0', '0', '2026-10-09 09:12:06','اضافة فاتورة مبيعات رقم 254 - صرف البضاعة من المخزن','1','0',null,'0','254','sellbillController.php?do=showDetail&sellbillid=254'); -- id=1630
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1630', '402', '13843.8', '','0'); -- id=1653
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2617156.59', 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 ('1630', '382', '13843.8', '','0'); -- id=1630
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20070961.61', 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='1629,0,1630' where sellbillid=254;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 14685, 14310, 14310
                    , 14310, 13843.8, 13843.8, 13843.8
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14310, 14310, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14685, sellCostBuyPrice =sellCostBuyPrice+14310
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14310, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14310
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13843.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13843.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13843.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14310
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14310
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 14685, 14310, 14310
                    , 14310, 13843.8, 13843.8, 13843.8
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14310, 14310, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14685, sellCostBuyPrice =sellCostBuyPrice+14310
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14310, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14310
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13843.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13843.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13843.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14310
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14310
                        , returnSellVal = returnSellVal+0, 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, 14685, 14310, 14310
                    , 14310, 13843.8, 13843.8, 13843.8, 14310, 14310)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+14685, netSellCostBuyPrice = netSellCostBuyPrice+14310
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+14310
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+14310
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+13843.8
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+13843.8
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+13843.8
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+14310
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+14310;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac883bc379e5 and sellbillId = 254 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:42:06";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:12:06", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:12:06', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5497
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:42:17";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:42:31";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:12:31", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 09:12:31', '4', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5498
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:42:31";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 09:12:31", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 09:12:31', '4', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5499
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:42:34";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:12:34", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:12:34', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5500
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:43:44";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:13:44", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:13:44', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5501

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac885d252fc7
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:13:44', '06ac885d252fc7', '1', '0.00', '0', '0', '1', '3300.00', '3300', '3300', '0', '2', '2026-10-09 09:13:44', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '6' ,'0','','','','','-1','0','0','0','0','0','3300','0','','0','0','3300','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=255
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','255', '0', '2026-10-09 09:13:44', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3300', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:13:44','0','0','',''); -- id=362
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 621;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('495','01722', '255', '49', '1722', '6', '550', '3300', '0', '', '0', '2026-10-09 09:13:44', '1722', '0.00', '0', '2','0.00','','','0','0','0','0','0','0','0','0','','621-6,','1','1','0','0','550','3300','0','','0','0.00','0','0','0','0'); -- id=966
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 495.00, meanbuyprice_withDiscount = 495.00
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 495
                where sellbilldetailid = 966;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1722, '2026-10-09', 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2970
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2970
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2970
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2970
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '99', userid = '4', storedetaildate = '2026-10-09 09:13:44' WHERE storedetailid = '2735';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1722', '2', '6', '1', '255', 'اضافة فاتورة مبيعات', 'sellbillController.php', '105', '99', '4', '2026-10-09 09:13:44','0','0'); -- id=3798
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '330240',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('326940','3300', '0', '3', 'اضافة فاتورة مبيعات', '255', '330240', '2026-10-09 09:13:44', '4',  'sellbillController.php','1','','0'); -- id=300
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3300', '3300', '2026-10-09', '4', '0', '0', '2026-10-09 09:13:44','اضافة فاتورة مبيعات رقم 255','1','0',null,'0','255','sellbillController.php?do=showDetail&sellbillid=255'); -- id=1631
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1631', '501', '3300', '','0'); -- id=1654
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '330240', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1631', '143', '3300', '','0'); -- id=1631
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2776140', 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 ( '2970', '2970', '2026-10-09', '4', '0', '0', '2026-10-09 09:13:44','اضافة فاتورة مبيعات رقم 255 - صرف البضاعة من المخزن','1','0',null,'0','255','sellbillController.php?do=showDetail&sellbillid=255'); -- id=1632
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1632', '402', '2970', '','0'); -- id=1655
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2620126.59', 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 ('1632', '492', '2970', '','0'); -- id=1632
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '831735', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1631,0,1632' where sellbillid=255;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2970
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2970
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2970
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2970
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, 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, 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970, 3300, 3300)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3300, netSellCostBuyPrice = netSellCostBuyPrice+3300
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3300
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3300
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2970
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2970
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2970
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3300
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3300;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac885d252fc7 and sellbillId = 255 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:43:44";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:13:44", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:13:44', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5502
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:46:24";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:16:24", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:16:24', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5503

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac885ab81269
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:16:24', '06ac885ab81269', '1', '0.00', '0', '0', '1', '13080.00', '13080', '13080', '0', '1', '2026-10-09 09:16:24', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '30' ,'0','','','','','-1','0','0','0','0','0','13080','0','','0','0','13080','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=256
UPDATE client SET  clientdebt = '0', userid = '3' 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','اضافة فاتورة مبيعات','256', '0', '2026-10-09 09:16:24', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '13080', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:16:24','0','0','',''); -- id=363
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 580;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('520','01717', '256', '131', '1717', '6', '545', '3270', '0', '', '0', '2026-10-09 09:16:24', '1717', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','580-6,','1','1','0','0','545','3270','0','','0','0.00','0','0','0','0'); -- id=967
UPDATE sellbilldetail SET  lastbuyprice = 520.00 , meanbuyprice = 520.00, lastbuyprice_withDiscount = 520.00, meanbuyprice_withDiscount = 520.00
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 520
                where sellbilldetailid = 967;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1717, '2026-10-09', 3270, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3270, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3270, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3270, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '138', userid = '3', storedetaildate = '2026-10-09 09:16:24' WHERE storedetailid = '2729';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1717', '1', '6', '1', '256', 'اضافة فاتورة مبيعات', 'sellbillController.php', '144', '138', '3', '2026-10-09 09:16:24','0','0'); -- id=3799
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 559;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('386.4','01695', '256', '127', '1695', '6', '420', '2520', '0', '', '0', '2026-10-09 09:16:24', '1695', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','559-6,','1','1','0','0','420','2520','0','','0','0.00','0','0','0','0'); -- id=968
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 420.00, lastbuyprice_withDiscount = 386.40, meanbuyprice_withDiscount = 386.40
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 386.4
                where sellbilldetailid = 968;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1695, '2026-10-09', 2520, 2520, 2520
                    , 2520, 2318.4, 2318.4, 2318.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2520, 2520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2318.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2318.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2318.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2520, 2520, 2520
                    , 2520, 2318.4, 2318.4, 2318.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2520, 2520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2318.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2318.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2318.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '168', userid = '3', storedetaildate = '2026-10-09 09:16:24' WHERE storedetailid = '2707';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1695', '1', '6', '1', '256', 'اضافة فاتورة مبيعات', 'sellbillController.php', '174', '168', '3', '2026-10-09 09:16:24','0','0'); -- id=3800
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','01379', '256', '94', '1379', '3', '300', '900', '0', '', '0', '2026-10-09 09:16:24', '1379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','71-3,','1','1','0','0','300','900','0','','0','0.00','0','0','0','0'); -- id=969
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 969;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-09', 900, 810, 810
                    , 810, 810, 810, 810
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 810, 810, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+900, sellCostBuyPrice =sellCostBuyPrice+810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+810, sellCostMeanBuyPrice = sellCostMeanBuyPrice+810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+810
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+810
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+810
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 900, 810, 810
                    , 810, 810, 810, 810
                    , 0, 0, 0, 0
                    , 0, 0, 0, 810, 810, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+900, sellCostBuyPrice =sellCostBuyPrice+810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+810, sellCostMeanBuyPrice = sellCostMeanBuyPrice+810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+810
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+810
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+810
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '678', userid = '3', storedetaildate = '2026-10-09 09:16:24' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '3', '1', '256', 'اضافة فاتورة مبيعات', 'sellbillController.php', '681', '678', '3', '2026-10-09 09:16:24','0','0'); -- id=3801
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 313;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('373.5','01535', '256', '111', '1535', '3', '415', '1245', '0', '', '0', '2026-10-09 09:16:24', '1535', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','313-3,','1','1','0','0','415','1245','0','','0','0.00','0','0','0','0'); -- id=970
UPDATE sellbilldetail SET  lastbuyprice = 415.00 , meanbuyprice = 415.00, lastbuyprice_withDiscount = 373.50, meanbuyprice_withDiscount = 373.50
        , lastbuyprice_withTax = 415, meanbuyprice_withTax = 415, lastbuyprice_withDiscountAndTax = 373.5
                where sellbilldetailid = 970;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1535, '2026-10-09', 1245, 1245, 1245
                    , 1245, 1120.5, 1120.5, 1120.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1245, 1245, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1245, sellCostBuyPrice =sellCostBuyPrice+1245
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1245, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1245
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1120.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1120.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1120.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1245
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1245
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1245, 1245, 1245
                    , 1245, 1120.5, 1120.5, 1120.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1245, 1245, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1245, sellCostBuyPrice =sellCostBuyPrice+1245
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1245, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1245
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1120.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1120.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1120.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1245
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1245
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '3', storedetaildate = '2026-10-09 09:16:24' WHERE storedetailid = '1560';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1535', '1', '3', '1', '256', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '30', '3', '2026-10-09 09:16:24','0','0'); -- id=3802
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 557;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('423.2','01693', '256', '127', '1693', '3', '460', '1380', '0', '', '0', '2026-10-09 09:16:24', '1693', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','557-3,','1','1','0','0','460','1380','0','','0','0.00','0','0','0','0'); -- id=971
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 423.20, meanbuyprice_withDiscount = 423.20
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 423.2
                where sellbilldetailid = 971;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1693, '2026-10-09', 1380, 1380, 1380
                    , 1380, 1269.6, 1269.6, 1269.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1269.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1269.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1269.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1380, 1380, 1380
                    , 1380, 1269.6, 1269.6, 1269.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1269.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1269.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1269.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '3', storedetaildate = '2026-10-09 09:16:24' WHERE storedetailid = '2705';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1693', '1', '3', '1', '256', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '27', '3', '2026-10-09 09:16:24','0','0'); -- id=3803
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 505;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('362.7','01659', '256', '125', '1659', '6', '390', '2340', '0', '', '0', '2026-10-09 09:16:24', '1659', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','505-6,','1','1','0','0','390','2340','0','','0','0.00','0','0','0','0'); -- id=972
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 362.70, meanbuyprice_withDiscount = 362.70
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 362.7
                where sellbilldetailid = 972;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1659, '2026-10-09', 2340, 2340, 2340
                    , 2340, 2176.2, 2176.2, 2176.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2340, 2340, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2340
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2340, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2340
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2176.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2176.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2176.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2340
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2340
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2340, 2340, 2340
                    , 2340, 2176.2, 2176.2, 2176.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2340, 2340, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2340
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2340, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2340
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2176.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2176.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2176.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2340
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2340
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '207', userid = '3', storedetaildate = '2026-10-09 09:16:24' WHERE storedetailid = '2671';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1659', '1', '6', '1', '256', 'اضافة فاتورة مبيعات', 'sellbillController.php', '213', '207', '3', '2026-10-09 09:16:24','0','0'); -- id=3804
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 310;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('427.5','01532', '256', '111', '1532', '3', '475', '1425', '0', '', '0', '2026-10-09 09:16:24', '1532', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','310-3,','1','1','0','0','475','1425','0','','0','0.00','0','0','0','0'); -- id=973
UPDATE sellbilldetail SET  lastbuyprice = 475.00 , meanbuyprice = 475.00, lastbuyprice_withDiscount = 427.50, meanbuyprice_withDiscount = 427.50
        , lastbuyprice_withTax = 475, meanbuyprice_withTax = 475, lastbuyprice_withDiscountAndTax = 427.5
                where sellbilldetailid = 973;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1532, '2026-10-09', 1425, 1425, 1425
                    , 1425, 1282.5, 1282.5, 1282.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1425, 1425, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1425, sellCostBuyPrice =sellCostBuyPrice+1425
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1425, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1425
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1282.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1282.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1282.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1425
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1425
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1425, 1425, 1425
                    , 1425, 1282.5, 1282.5, 1282.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1425, 1425, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1425, sellCostBuyPrice =sellCostBuyPrice+1425
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1425, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1425
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1282.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1282.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1282.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1425
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1425
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '11', userid = '3', storedetaildate = '2026-10-09 09:16:24' WHERE storedetailid = '1557';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1532', '1', '3', '1', '256', 'اضافة فاتورة مبيعات', 'sellbillController.php', '14', '11', '3', '2026-10-09 09:16:24','0','0'); -- id=3805
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1448810',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1435730','13080', '0', '2', 'اضافة فاتورة مبيعات', '256', '1448810', '2026-10-09 09:16:24', '3',  'sellbillController.php','1','','0'); -- id=301
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '13080', '13080', '2026-10-09', '3', '0', '0', '2026-10-09 09:16:24','اضافة فاتورة مبيعات رقم 256','1','0',null,'0','256','sellbillController.php?do=showDetail&sellbillid=256'); -- id=1633
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1633', '419', '13080', '','0'); -- id=1656
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1448810', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1633', '143', '13080', '','0'); -- id=1633
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2789220', 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 ( '12097.2', '12097.2', '2026-10-09', '3', '0', '0', '2026-10-09 09:16:24','اضافة فاتورة مبيعات رقم 256 - صرف البضاعة من المخزن','1','0',null,'0','256','sellbillController.php?do=showDetail&sellbillid=256'); -- id=1634
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1634', '402', '12097.2', '','0'); -- id=1657
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2632223.79', 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 ('1634', '382', '12097.2', '','0'); -- id=1634
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20058864.41', 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='1633,0,1634' where sellbillid=256;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 13080, 12840, 12840
                    , 12840, 12097.2, 12097.2, 12097.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12840, 12840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13080, sellCostBuyPrice =sellCostBuyPrice+12840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12097.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12097.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12097.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 13080, 12840, 12840
                    , 12840, 12097.2, 12097.2, 12097.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12840, 12840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13080, sellCostBuyPrice =sellCostBuyPrice+12840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12097.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12097.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12097.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12840
                        , returnSellVal = returnSellVal+0, 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, 13080, 12840, 12840
                    , 12840, 12097.2, 12097.2, 12097.2, 12840, 12840)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+13080, netSellCostBuyPrice = netSellCostBuyPrice+12840
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+12840
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+12840
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+12097.2
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+12097.2
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+12097.2
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+12840
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+12840;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac885ab81269 and sellbillId = 256 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:46:25";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:16:25", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:16:25', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5504
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:46:35";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:16:35", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:16:35', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=256'); -- id=5505
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:48:41";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:18:41", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:18:41', '6', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5506

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac88210e347b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:18:41', '06ac88210e347b', '1', '0.00', '0', '0', '1', '21200.00', '21200', '21200', '0', '1', '2026-10-09 09:18:41', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '26' ,'0','','','','','-1','0','0','0','0','0','21200','0','','0','0','21200','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=257
UPDATE client SET  clientdebt = '0', userid = '6' 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','اضافة فاتورة مبيعات','257', '0', '2026-10-09 09:18:41', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '21200', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:18:41','0','0','',''); -- id=364
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 647;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('750','01734', '257', '133', '1734', '8', '750', '6000', '0', '', '0', '2026-10-09 09:18:41', '1734', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','647-8,','1','1','0','0','750','6000','0','','0','0.00','0','0','0','0'); -- id=974
UPDATE sellbilldetail SET  lastbuyprice = 750.00 , meanbuyprice = 750.00, lastbuyprice_withDiscount = 750.00, meanbuyprice_withDiscount = 750.00
        , lastbuyprice_withTax = 750, meanbuyprice_withTax = 750, lastbuyprice_withDiscountAndTax = 750
                where sellbilldetailid = 974;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1734, '2026-10-09', 6000, 6000, 6000
                    , 6000, 6000, 6000, 6000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 6000, 6000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+6000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 6000, 6000, 6000
                    , 6000, 6000, 6000, 6000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6000, 6000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+6000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '100', userid = '6', storedetaildate = '2026-10-09 09:18:41' WHERE storedetailid = '2747';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1734', '1', '8', '1', '257', 'اضافة فاتورة مبيعات', 'sellbillController.php', '108', '100', '6', '2026-10-09 09:18:41','0','0'); -- id=3806
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 648;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('900','01735', '257', '133', '1735', '8', '900', '7200', '0', '', '0', '2026-10-09 09:18:41', '1735', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','648-8,','1','1','0','0','900','7200','0','','0','0.00','0','0','0','0'); -- id=975
UPDATE sellbilldetail SET  lastbuyprice = 900.00 , meanbuyprice = 900.00, lastbuyprice_withDiscount = 900.00, meanbuyprice_withDiscount = 900.00
        , lastbuyprice_withTax = 900, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 900
                where sellbilldetailid = 975;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1735, '2026-10-09', 7200, 7200, 7200
                    , 7200, 7200, 7200, 7200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 7200, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7200, sellCostBuyPrice =sellCostBuyPrice+7200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 7200, 7200, 7200
                    , 7200, 7200, 7200, 7200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7200, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7200, sellCostBuyPrice =sellCostBuyPrice+7200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '6', storedetaildate = '2026-10-09 09:18:41' WHERE storedetailid = '2748';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1735', '1', '8', '1', '257', 'اضافة فاتورة مبيعات', 'sellbillController.php', '32', '24', '6', '2026-10-09 09:18:41','0','0'); -- id=3807
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 650;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('800','01737', '257', '133', '1737', '4', '800', '3200', '0', '', '0', '2026-10-09 09:18:41', '1737', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','650-4,','1','1','0','0','800','3200','0','','0','0.00','0','0','0','0'); -- id=976
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 800
                where sellbilldetailid = 976;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1737, '2026-10-09', 3200, 3200, 3200
                    , 3200, 3200, 3200, 3200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 3200, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3200, sellCostBuyPrice =sellCostBuyPrice+3200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3200, 3200, 3200
                    , 3200, 3200, 3200, 3200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3200, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3200, sellCostBuyPrice =sellCostBuyPrice+3200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '36', userid = '6', storedetaildate = '2026-10-09 09:18:41' WHERE storedetailid = '2750';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1737', '1', '4', '1', '257', 'اضافة فاتورة مبيعات', 'sellbillController.php', '40', '36', '6', '2026-10-09 09:18:41','0','0'); -- id=3808
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 561;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('800','01698', '257', '130', '1698', '3', '850', '2550', '0', '', '0', '2026-10-09 09:18:41', '1698', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','561-3,','1','1','0','0','850','2550','0','','0','0.00','0','0','0','0'); -- id=977
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 800, lastbuyprice_withDiscountAndTax = 800
                where sellbilldetailid = 977;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1698, '2026-10-09', 2550, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2550, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '6', storedetaildate = '2026-10-09 09:18:41' WHERE storedetailid = '2710';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1698', '1', '3', '1', '257', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '30', '6', '2026-10-09 09:18:41','0','0'); -- id=3809
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 287;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('720','01509', '257', '109', '1509', '3', '750', '2250', '0', '', '0', '2026-10-09 09:18:41', '1509', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','287-3,','1','1','0','0','750','2250','0','','0','0.00','0','0','0','0'); -- id=978
UPDATE sellbilldetail SET  lastbuyprice = 720.00 , meanbuyprice = 720.00, lastbuyprice_withDiscount = 720.00, meanbuyprice_withDiscount = 720.00
        , lastbuyprice_withTax = 720, meanbuyprice_withTax = 720, lastbuyprice_withDiscountAndTax = 720
                where sellbilldetailid = 978;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1509, '2026-10-09', 2250, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2250, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2250, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2250, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '6', storedetaildate = '2026-10-09 09:18:42' WHERE storedetailid = '1534';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1509', '1', '3', '1', '257', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '12', '6', '2026-10-09 09:18:42','0','0'); -- id=3810
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '34430',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('13230','21200', '0', '4', 'اضافة فاتورة مبيعات', '257', '34430', '2026-10-09 09:18:42', '6',  'sellbillController.php','1','','0'); -- id=302
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '21200', '21200', '2026-10-09', '6', '0', '0', '2026-10-09 09:18:42','اضافة فاتورة مبيعات رقم 257','1','0',null,'0','257','sellbillController.php?do=showDetail&sellbillid=257'); -- id=1635
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1635', '568', '21200', '','0'); -- id=1658
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '34430', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1635', '143', '21200', '','0'); -- id=1635
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2810420', 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 ( '20960', '20960', '2026-10-09', '6', '0', '0', '2026-10-09 09:18:42','اضافة فاتورة مبيعات رقم 257 - صرف البضاعة من المخزن','1','0',null,'0','257','sellbillController.php?do=showDetail&sellbillid=257'); -- id=1636
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1636', '402', '20960', '','0'); -- id=1659
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2653183.79', 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 ('1636', '382', '20960', '','0'); -- id=1636
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20037904.41', 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='1635,0,1636' where sellbillid=257;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 21200, 20960, 20960
                    , 20960, 20960, 20960, 20960
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,20960, 15760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21200, sellCostBuyPrice =sellCostBuyPrice+20960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 21200, 20960, 20960
                    , 20960, 20960, 20960, 20960
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,20960, 15760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21200, sellCostBuyPrice =sellCostBuyPrice+20960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15760
                        , returnSellVal = returnSellVal+0, 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, 21200, 20960, 20960
                    , 20960, 20960, 20960, 20960, 20960, 15760)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+21200, netSellCostBuyPrice = netSellCostBuyPrice+20960
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+20960
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+20960
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+20960
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+20960
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+20960
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+20960
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+15760;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac88210e347b and sellbillId = 257 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:48:42";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:18:42", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:18:42', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5507
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:49:18";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:19:18", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 09:19:18', '3', 'showbarcode', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=5508
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:49:22";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:19:22", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 09:19:22', '3', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5509
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:49:22";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:19:22", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 09:19:22', '3', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5510
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:51:18";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:21:18", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:21:18', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5511
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:51:18";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:21:18", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:21:18', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5512
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:52:09";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:22:09", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:22:09', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5513

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8861877c6f
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:22:09', '06ac8861877c6f', '1', '0.00', '0', '0', '1', '3440.00', '3440', '3440', '0', '2', '2026-10-09 09:22:09', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '8' ,'0','','','','','-1','0','0','0','0','0','3440','0','','0','0','3440','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=258
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','258', '0', '2026-10-09 09:22:09', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3440', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:22:09','0','0','',''); -- id=365
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 220;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('400','01439', '258', '88', '1439', '8', '430', '3440', '0', '', '0', '2026-10-09 09:22:09', '1439', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','220-8,','1','1','0','0','430','3440','0','','0','0.00','0','0','0','0'); -- id=979
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 400.00, meanbuyprice_withDiscount = 400.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 400
                where sellbilldetailid = 979;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1439, '2026-10-09', 3440, 3200, 3200
                    , 3200, 3200, 3200, 3200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 3200, 3200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3440, sellCostBuyPrice =sellCostBuyPrice+3200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 3440, 3200, 3200
                    , 3200, 3200, 3200, 3200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3200, 3200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3440, sellCostBuyPrice =sellCostBuyPrice+3200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '4', storedetaildate = '2026-10-09 09:22:09' WHERE storedetailid = '1470';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1439', '2', '8', '1', '258', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16', '8', '4', '2026-10-09 09:22:09','0','0'); -- id=3811
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '333680',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('330240','3440', '0', '3', 'اضافة فاتورة مبيعات', '258', '333680', '2026-10-09 09:22:09', '4',  'sellbillController.php','1','','0'); -- id=303
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3440', '3440', '2026-10-09', '4', '0', '0', '2026-10-09 09:22:09','اضافة فاتورة مبيعات رقم 258','1','0',null,'0','258','sellbillController.php?do=showDetail&sellbillid=258'); -- id=1637
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1637', '501', '3440', '','0'); -- id=1660
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '333680', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1637', '143', '3440', '','0'); -- id=1637
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2813860', 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 ( '3200', '3200', '2026-10-09', '4', '0', '0', '2026-10-09 09:22:09','اضافة فاتورة مبيعات رقم 258 - صرف البضاعة من المخزن','1','0',null,'0','258','sellbillController.php?do=showDetail&sellbillid=258'); -- id=1638
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1638', '402', '3200', '','0'); -- id=1661
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2656383.79', 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 ('1638', '492', '3200', '','0'); -- id=1638
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '828535', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1637,0,1638' where sellbillid=258;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 3440, 3200, 3200
                    , 3200, 3200, 3200, 3200
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3200, 3200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3440, sellCostBuyPrice =sellCostBuyPrice+3200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3440, 3200, 3200
                    , 3200, 3200, 3200, 3200
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3200, 3200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3440, sellCostBuyPrice =sellCostBuyPrice+3200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3200
                        , returnSellVal = returnSellVal+0, 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, 3440, 3200, 3200
                    , 3200, 3200, 3200, 3200, 3200, 3200)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3440, netSellCostBuyPrice = netSellCostBuyPrice+3200
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3200
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3200
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3200
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3200
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3200
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3200
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3200;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8861877c6f and sellbillId = 258 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 05:52:10";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:22:10", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:22:10', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5514
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:00:12";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:30:12", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:30:12', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5515

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac888121bfeb
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:30:12', '06ac888121bfeb', '1', '0.00', '0', '0', '1', '6600.00', '6600', '6600', '0', '2', '2026-10-09 09:30:12', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '12' ,'0','','','','','-1','0','0','0','0','0','6600','0','','0','0','6600','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=259
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','259', '0', '2026-10-09 09:30:12', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '6600', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:30:12','0','0','',''); -- id=366
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 621;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('495','01722', '259', '49', '1722', '12', '550', '6600', '0', '', '0', '2026-10-09 09:30:12', '1722', '0.00', '0', '2','0.00','','','0','0','0','0','0','0','0','0','','621-12,','1','1','0','0','550','6600','0','','0','0.00','0','0','0','0'); -- id=980
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 495.00, meanbuyprice_withDiscount = 495.00
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 495
                where sellbilldetailid = 980;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1722, '2026-10-09', 6600, 6600, 6600
                    , 6600, 5940, 5940, 5940
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 6600, 6600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6600, sellCostBuyPrice =sellCostBuyPrice+6600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-09', 6600, 6600, 6600
                    , 6600, 5940, 5940, 5940
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6600, 6600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6600, sellCostBuyPrice =sellCostBuyPrice+6600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '87', userid = '4', storedetaildate = '2026-10-09 09:30:12' WHERE storedetailid = '2735';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1722', '2', '12', '1', '259', 'اضافة فاتورة مبيعات', 'sellbillController.php', '99', '87', '4', '2026-10-09 09:30:12','0','0'); -- id=3812
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '340280',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('333680','6600', '0', '3', 'اضافة فاتورة مبيعات', '259', '340280', '2026-10-09 09:30:12', '4',  'sellbillController.php','1','','0'); -- id=304
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6600', '6600', '2026-10-09', '4', '0', '0', '2026-10-09 09:30:12','اضافة فاتورة مبيعات رقم 259','1','0',null,'0','259','sellbillController.php?do=showDetail&sellbillid=259'); -- id=1639
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1639', '501', '6600', '','0'); -- id=1662
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '340280', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1639', '143', '6600', '','0'); -- id=1639
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2820460', 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 ( '5940', '5940', '2026-10-09', '4', '0', '0', '2026-10-09 09:30:12','اضافة فاتورة مبيعات رقم 259 - صرف البضاعة من المخزن','1','0',null,'0','259','sellbillController.php?do=showDetail&sellbillid=259'); -- id=1640
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1640', '402', '5940', '','0'); -- id=1663
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2662323.79', 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 ('1640', '492', '5940', '','0'); -- id=1640
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '822595', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1639,0,1640' where sellbillid=259;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 6600, 6600, 6600
                    , 6600, 5940, 5940, 5940
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6600, 6600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6600, sellCostBuyPrice =sellCostBuyPrice+6600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 6600, 6600, 6600
                    , 6600, 5940, 5940, 5940
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6600, 6600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6600, sellCostBuyPrice =sellCostBuyPrice+6600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6600
                        , returnSellVal = returnSellVal+0, 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, 6600, 6600, 6600
                    , 6600, 5940, 5940, 5940, 6600, 6600)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6600, netSellCostBuyPrice = netSellCostBuyPrice+6600
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+6600
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+6600
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5940
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5940
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5940
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+6600
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+6600;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac888121bfeb and sellbillId = 259 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:00:12";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:30:12", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:30:12', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5516
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:02:46";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:32:46", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:32:46', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5517

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac885b6d15c1
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac885b6d15c1 and sellbillId = 260 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:02:46";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:32:46", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:32:46', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5518
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:04:12";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:34:12", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:34:12', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5519

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac889f4f085e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:34:12', '06ac889f4f085e', '1', '0.00', '0', '0', '1', '4560.00', '4560', '4560', '0', '2', '2026-10-09 09:34:12', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '12' ,'0','','','','','-1','0','0','0','0','0','4560','0','','0','0','4560','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=261
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','261', '0', '2026-10-09 09:34:12', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '4560', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:34:12','0','0','',''); -- id=368
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 495;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01551', '261', '112', '1551', '12', '380', '4560', '0', '', '0', '2026-10-09 09:34:12', '1551', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','495-12,','1','1','0','0','380','4560','0','','0','0.00','0','0','0','0'); -- id=982
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 982;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1551, '2026-10-09', 4560, 3840, 3840
                    , 3840, 3840, 3840, 3840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3840, 3840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4560, sellCostBuyPrice =sellCostBuyPrice+3840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-09', 4560, 3840, 3840
                    , 3840, 3840, 3840, 3840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3840, 3840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4560, sellCostBuyPrice =sellCostBuyPrice+3840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '468', userid = '4', storedetaildate = '2026-10-09 09:34:12' WHERE storedetailid = '2563';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1551', '2', '12', '1', '261', 'اضافة فاتورة مبيعات', 'sellbillController.php', '480', '468', '4', '2026-10-09 09:34:12','0','0'); -- id=3814
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '344840',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('340280','4560', '0', '3', 'اضافة فاتورة مبيعات', '261', '344840', '2026-10-09 09:34:12', '4',  'sellbillController.php','1','','0'); -- id=306
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4560', '4560', '2026-10-09', '4', '0', '0', '2026-10-09 09:34:12','اضافة فاتورة مبيعات رقم 261','1','0',null,'0','261','sellbillController.php?do=showDetail&sellbillid=261'); -- id=1643
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1643', '501', '4560', '','0'); -- id=1666
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '344840', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1643', '143', '4560', '','0'); -- id=1643
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2826190', 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 ( '3840', '3840', '2026-10-09', '4', '0', '0', '2026-10-09 09:34:12','اضافة فاتورة مبيعات رقم 261 - صرف البضاعة من المخزن','1','0',null,'0','261','sellbillController.php?do=showDetail&sellbillid=261'); -- id=1644
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1644', '402', '3840', '','0'); -- id=1667
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2667213.79', 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 ('1644', '492', '3840', '','0'); -- id=1644
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '818755', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1643,0,1644' where sellbillid=261;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 4560, 3840, 3840
                    , 3840, 3840, 3840, 3840
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3840, 3840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4560, sellCostBuyPrice =sellCostBuyPrice+3840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4560, 3840, 3840
                    , 3840, 3840, 3840, 3840
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3840, 3840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4560, sellCostBuyPrice =sellCostBuyPrice+3840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3840
                        , returnSellVal = returnSellVal+0, 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, 4560, 3840, 3840
                    , 3840, 3840, 3840, 3840, 3840, 3840)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+4560, netSellCostBuyPrice = netSellCostBuyPrice+3840
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3840
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3840
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3840
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3840
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3840
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3840
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3840;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac889f4f085e and sellbillId = 261 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:04:12";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:34:12", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:34:12', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5520
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:04:35";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:34:35", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:34:35', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5521

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac88a8ee78fc
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:34:35', '06ac88a8ee78fc', '1', '0.00', '0', '0', '1', '1995.00', '1995', '1995', '0', '1', '2026-10-09 09:34:35', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '9' ,'0','','','','','-1','0','0','0','0','0','1995','0','','0','0','1995','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=262
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','262', '0', '2026-10-09 09:34:35', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1995', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:34:35','0','0','',''); -- id=369
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 201;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('216','01452', '262', '101', '1452', '6', '240', '1440', '0', '', '0', '2026-10-09 09:34:35', '1452', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','201-6,','1','1','0','0','240','1440','0','','0','0.00','0','0','0','0'); -- id=983
UPDATE sellbilldetail SET  lastbuyprice = 240.00 , meanbuyprice = 240.00, lastbuyprice_withDiscount = 216.00, meanbuyprice_withDiscount = 216.00
        , lastbuyprice_withTax = 240, meanbuyprice_withTax = 240, lastbuyprice_withDiscountAndTax = 216
                where sellbilldetailid = 983;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1452, '2026-10-09', 1440, 1440, 1440
                    , 1440, 1296, 1296, 1296
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1440, 1440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1296, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1296
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1296
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1440, 1440, 1440
                    , 1440, 1296, 1296, 1296
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1440, 1440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1296, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1296
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1296
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '33', userid = '2', storedetaildate = '2026-10-09 09:34:35' WHERE storedetailid = '1469';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1452', '1', '6', '1', '262', 'اضافة فاتورة مبيعات', 'sellbillController.php', '39', '33', '2', '2026-10-09 09:34:35','0','0'); -- id=3815
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 198;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('166.5','01449', '262', '101', '1449', '3', '185', '555', '0', '', '0', '2026-10-09 09:34:35', '1449', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','198-3,','1','1','0','0','185','555','0','','0','0.00','0','0','0','0'); -- id=984
UPDATE sellbilldetail SET  lastbuyprice = 185.00 , meanbuyprice = 185.00, lastbuyprice_withDiscount = 166.50, meanbuyprice_withDiscount = 166.50
        , lastbuyprice_withTax = 185, meanbuyprice_withTax = 185, lastbuyprice_withDiscountAndTax = 166.5
                where sellbilldetailid = 984;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1449, '2026-10-09', 555, 555, 555
                    , 555, 499.5, 499.5, 499.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 555, 555, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+555, sellCostBuyPrice =sellCostBuyPrice+555
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+555, sellCostMeanBuyPrice = sellCostMeanBuyPrice+555
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+499.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+499.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+499.5
                            , 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+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 555, 555, 555
                    , 555, 499.5, 499.5, 499.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 555, 555, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+555, sellCostBuyPrice =sellCostBuyPrice+555
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+555, sellCostMeanBuyPrice = sellCostMeanBuyPrice+555
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+499.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+499.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+499.5
                            , 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 = '2', storedetaildate = '2026-10-09 09:34:35' WHERE storedetailid = '1466';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1449', '1', '3', '1', '262', 'اضافة فاتورة مبيعات', 'sellbillController.php', '114', '111', '2', '2026-10-09 09:34:35','0','0'); -- id=3816
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1451975',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1449980','1995', '0', '2', 'اضافة فاتورة مبيعات', '262', '1451975', '2026-10-09 09:34:35', '2',  'sellbillController.php','1','','0'); -- id=307
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1995', '1995', '2026-10-09', '2', '0', '0', '2026-10-09 09:34:35','اضافة فاتورة مبيعات رقم 262','1','0',null,'0','262','sellbillController.php?do=showDetail&sellbillid=262'); -- id=1645
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1645', '419', '1995', '','0'); -- id=1668
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1451975', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1645', '143', '1995', '','0'); -- id=1645
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2828185', 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 ( '1795.5', '1795.5', '2026-10-09', '2', '0', '0', '2026-10-09 09:34:35','اضافة فاتورة مبيعات رقم 262 - صرف البضاعة من المخزن','1','0',null,'0','262','sellbillController.php?do=showDetail&sellbillid=262'); -- id=1646
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1646', '402', '1795.5', '','0'); -- id=1669
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2669009.29', 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 ('1646', '382', '1795.5', '','0'); -- id=1646
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20035058.91', 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='1645,0,1646' where sellbillid=262;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 1995, 1995, 1995
                    , 1995, 1795.5, 1795.5, 1795.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1995, 1995, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1995, sellCostBuyPrice =sellCostBuyPrice+1995
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1995, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1995
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1795.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1795.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1795.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1995
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1995
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1995, 1995, 1995
                    , 1995, 1795.5, 1795.5, 1795.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1995, 1995, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1995, sellCostBuyPrice =sellCostBuyPrice+1995
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1995, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1995
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1795.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1795.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1795.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1995
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1995
                        , returnSellVal = returnSellVal+0, 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, 1995, 1995, 1995
                    , 1995, 1795.5, 1795.5, 1795.5, 1995, 1995)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1995, netSellCostBuyPrice = netSellCostBuyPrice+1995
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1995
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1995
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1795.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1795.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1795.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1995
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1995;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac88a8ee78fc and sellbillId = 262 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:04:35";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:34:35", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:34:35', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5522
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:12:35";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:42:35", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:42:35', '6', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5523

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac887423c31a
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:42:35', '06ac887423c31a', '1', '0.00', '0', '0', '1', '3870.00', '3870', '3870', '0', '1', '2026-10-09 09:42:35', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '6' ,'0','','','','','-1','0','0','0','0','0','3870','0','','0','0','3870','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=263
UPDATE client SET  clientdebt = '0', userid = '6' 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','اضافة فاتورة مبيعات','263', '0', '2026-10-09 09:42:35', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3870', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:42:35','0','0','',''); -- id=370
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 186;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('558','01418', '263', '98', '1418', '3', '620', '1860', '0', '', '0', '2026-10-09 09:42:35', '1418', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','186-3,','1','1','0','0','620','1860','0','','0','0.00','0','0','0','0'); -- id=985
UPDATE sellbilldetail SET  lastbuyprice = 620.00 , meanbuyprice = 620.00, lastbuyprice_withDiscount = 558.00, meanbuyprice_withDiscount = 589.00
        , lastbuyprice_withTax = 620, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 558
                where sellbilldetailid = 985;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1418, '2026-10-09', 1860, 1860, 1860
                    , 1860, 1674, 1767, 1674
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1860, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1860, sellCostBuyPrice =sellCostBuyPrice+1860
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1860, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1860
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1674, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1767
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1674
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1860
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1860, 1860, 1860
                    , 1860, 1674, 1767, 1674
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1860, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1860, sellCostBuyPrice =sellCostBuyPrice+1860
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1860, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1860
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1674, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1767
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1674
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1860
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '6', storedetaildate = '2026-10-09 09:42:35' WHERE storedetailid = '1431';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1418', '1', '3', '1', '263', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '30', '6', '2026-10-09 09:42:35','0','0'); -- id=3817
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 290;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('640','01512', '263', '109', '1512', '3', '670', '2010', '0', '', '0', '2026-10-09 09:42:35', '1512', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','290-3,','1','1','0','0','670','2010','0','','0','0.00','0','0','0','0'); -- id=986
UPDATE sellbilldetail SET  lastbuyprice = 640.00 , meanbuyprice = 640.00, lastbuyprice_withDiscount = 640.00, meanbuyprice_withDiscount = 640.00
        , lastbuyprice_withTax = 640, meanbuyprice_withTax = 640, lastbuyprice_withDiscountAndTax = 640
                where sellbilldetailid = 986;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1512, '2026-10-09', 2010, 1920, 1920
                    , 1920, 1920, 1920, 1920
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1920, 1920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2010, sellCostBuyPrice =sellCostBuyPrice+1920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1920, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1920
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1920
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2010, 1920, 1920
                    , 1920, 1920, 1920, 1920
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1920, 1920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2010, sellCostBuyPrice =sellCostBuyPrice+1920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1920, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1920
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1920
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '6', storedetaildate = '2026-10-09 09:42:35' WHERE storedetailid = '1537';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1512', '1', '3', '1', '263', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '27', '6', '2026-10-09 09:42:35','0','0'); -- id=3818
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '38300',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('34430','3870', '0', '4', 'اضافة فاتورة مبيعات', '263', '38300', '2026-10-09 09:42:35', '6',  'sellbillController.php','1','','0'); -- id=308
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3870', '3870', '2026-10-09', '6', '0', '0', '2026-10-09 09:42:35','اضافة فاتورة مبيعات رقم 263','1','0',null,'0','263','sellbillController.php?do=showDetail&sellbillid=263'); -- id=1647
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1647', '568', '3870', '','0'); -- id=1670
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '38300', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1647', '143', '3870', '','0'); -- id=1647
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2832055', 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 ( '3594', '3594', '2026-10-09', '6', '0', '0', '2026-10-09 09:42:35','اضافة فاتورة مبيعات رقم 263 - صرف البضاعة من المخزن','1','0',null,'0','263','sellbillController.php?do=showDetail&sellbillid=263'); -- id=1648
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1648', '402', '3594', '','0'); -- id=1671
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2672603.29', 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 ('1648', '382', '3594', '','0'); -- id=1648
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20031464.91', 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='1647,0,1648' where sellbillid=263;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 3870, 3780, 3780
                    , 3780, 3594, 3687, 3594
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3780, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3870, sellCostBuyPrice =sellCostBuyPrice+3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3594, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3687
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3594
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3870, 3780, 3780
                    , 3780, 3594, 3687, 3594
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3780, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3870, sellCostBuyPrice =sellCostBuyPrice+3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3594, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3687
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3594
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, 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, 3870, 3780, 3780
                    , 3780, 3594, 3687, 3594, 3780, 2850)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3870, netSellCostBuyPrice = netSellCostBuyPrice+3780
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3780
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3780
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3594
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3687
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3594
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3780
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2850;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac887423c31a and sellbillId = 263 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:12:35";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:42:35", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:42:35', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5524
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:13:47";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:43:47", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:43:47', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5525

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac88afb6bc46
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac88afb6bc46 and sellbillId = 264 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:13:47";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:43:47", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:43:47', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5526
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:15:28";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:45:28", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:45:28', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5527

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac887de7c7c0
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:45:28', '06ac887de7c7c0', '1', '0.00', '0', '55', '1', '24655.00', '24600', '24600', '0', '1', '2026-10-09 09:45:28', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '80' ,'0','','','','','-1','0','0','0','0','0','24600','0','','0','0','24600','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=265
UPDATE client SET  clientdebt = '0', userid = '3' 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','اضافة فاتورة مبيعات','265', '0', '2026-10-09 09:45:28', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '24600', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:45:28','0','0','',''); -- id=372
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','09517', '265', '6', '676', '15', '330', '4950', '0', '', '0', '2026-10-09 09:45:28', '676', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','330','4950','0','','0','0.00','0','0','0','0'); -- id=988
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 988;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (676, '2026-10-09', 4938.9576150882, 4650, 4650
                    , 4650, 4650, 4650, 4650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 4650, 4650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4938.9576150882, sellCostBuyPrice =sellCostBuyPrice+4650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-10-09', 4938.9576150882, 4650, 4650
                    , 4650, 4650, 4650, 4650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4650, 4650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4938.9576150882, sellCostBuyPrice =sellCostBuyPrice+4650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '290', userid = '3', storedetaildate = '2026-10-09 09:45:28' WHERE storedetailid = '676';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('676', '1', '15', '1', '265', 'اضافة فاتورة مبيعات', 'sellbillController.php', '305', '290', '3', '2026-10-09 09:45:28','0','0'); -- id=3820
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','09519', '265', '6', '678', '10', '380', '3800', '0', '', '0', '2026-10-09 09:45:28', '678', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','380','3800','0','','0','0.00','0','0','0','0'); -- id=989
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 989;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (678, '2026-10-09', 3791.5230176435, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3791.5230176435, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3791.5230176435, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3791.5230176435, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '88', userid = '3', storedetaildate = '2026-10-09 09:45:28' WHERE storedetailid = '678';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('678', '1', '10', '1', '265', 'اضافة فاتورة مبيعات', 'sellbillController.php', '98', '88', '3', '2026-10-09 09:45:28','0','0'); -- id=3821
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('295','08777', '265', '19', '837', '10', '315', '3150', '0', '', '0', '2026-10-09 09:45:28', '837', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','315','3150','0','','0','0.00','0','0','0','0'); -- id=990
UPDATE sellbilldetail SET  lastbuyprice = 295.00 , meanbuyprice = 295.00, lastbuyprice_withDiscount = 295.00, meanbuyprice_withDiscount = 295.00
        , lastbuyprice_withTax = 295, meanbuyprice_withTax = 295, lastbuyprice_withDiscountAndTax = 295
                where sellbilldetailid = 990;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (837, '2026-10-09', 3142.9730277834, 2950, 2950
                    , 2950, 2950, 2950, 2950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 2950, 2950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3142.9730277834, sellCostBuyPrice =sellCostBuyPrice+2950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3142.9730277834, 2950, 2950
                    , 2950, 2950, 2950, 2950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2950, 2950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3142.9730277834, sellCostBuyPrice =sellCostBuyPrice+2950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 09:45:28' WHERE storedetailid = '837';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('837', '1', '10', '1', '265', 'اضافة فاتورة مبيعات', 'sellbillController.php', '57', '47', '3', '2026-10-09 09:45:28','0','0'); -- id=3822
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('280','07630', '265', '36', '1083', '20', '300', '6000', '0', '', '0', '2026-10-09 09:45:28', '1083', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','300','6000','0','','0','0.00','0','0','0','0'); -- id=991
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 280.00, lastbuyprice_withDiscount = 280.00, meanbuyprice_withDiscount = 280.00
        , lastbuyprice_withTax = 280, meanbuyprice_withTax = 280, lastbuyprice_withDiscountAndTax = 280
                where sellbilldetailid = 991;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1083, '2026-10-09', 5986.615291016, 5600, 5600
                    , 5600, 5600, 5600, 5600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 5600, 5600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5986.615291016, sellCostBuyPrice =sellCostBuyPrice+5600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5986.615291016, 5600, 5600
                    , 5600, 5600, 5600, 5600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5600, 5600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5986.615291016, sellCostBuyPrice =sellCostBuyPrice+5600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '74', userid = '3', storedetaildate = '2026-10-09 09:45:28' WHERE storedetailid = '1083';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1083', '1', '20', '1', '265', 'اضافة فاتورة مبيعات', 'sellbillController.php', '94', '74', '3', '2026-10-09 09:45:28','0','0'); -- id=3823
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 202;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','i0001421', '265', '3', '1421', '5', '320', '1600', '0', '', '0', '2026-10-09 09:45:28', '1421', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','202-5,','1','1','0','0','320','1600','0','','0','0.00','0','0','0','0'); -- id=992
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 992;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1421, '2026-10-09', 1596.4307442709, 1500, 1500
                    , 1500, 1500, 1500, 1500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1500, 1500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1596.4307442709, sellCostBuyPrice =sellCostBuyPrice+1500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1596.4307442709, 1500, 1500
                    , 1500, 1500, 1500, 1500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1500, 1500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1596.4307442709, sellCostBuyPrice =sellCostBuyPrice+1500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '70', userid = '3', storedetaildate = '2026-10-09 09:45:28' WHERE storedetailid = '1434';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1421', '1', '5', '1', '265', 'اضافة فاتورة مبيعات', 'sellbillController.php', '75', '70', '3', '2026-10-09 09:45:28','0','0'); -- id=3824
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('315','09799', '265', '21', '866', '5', '335', '1675', '0', '', '0', '2026-10-09 09:45:28', '866', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','335','1675','0','','0','0.00','0','0','0','0'); -- id=993
UPDATE sellbilldetail SET  lastbuyprice = 315.00 , meanbuyprice = 315.00, lastbuyprice_withDiscount = 315.00, meanbuyprice_withDiscount = 315.00
        , lastbuyprice_withTax = 315, meanbuyprice_withTax = 315, lastbuyprice_withDiscountAndTax = 315
                where sellbilldetailid = 993;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (866, '2026-10-09', 1671.2634354086, 1575, 1575
                    , 1575, 1575, 1575, 1575
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1575, 1575, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1671.2634354086, sellCostBuyPrice =sellCostBuyPrice+1575
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1575, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1575
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1575, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1575
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1575
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1575
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1575
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1671.2634354086, 1575, 1575
                    , 1575, 1575, 1575, 1575
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1575, 1575, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1671.2634354086, sellCostBuyPrice =sellCostBuyPrice+1575
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1575, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1575
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1575, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1575
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1575
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1575
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1575
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '107', userid = '3', storedetaildate = '2026-10-09 09:45:28' WHERE storedetailid = '866';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('866', '1', '5', '1', '265', 'اضافة فاتورة مبيعات', 'sellbillController.php', '112', '107', '3', '2026-10-09 09:45:28','0','0'); -- id=3825
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 201;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('216','01452', '265', '101', '1452', '3', '240', '720', '0', '', '0', '2026-10-09 09:45:28', '1452', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','201-3,','1','1','0','0','240','720','0','','0','0.00','0','0','0','0'); -- id=994
UPDATE sellbilldetail SET  lastbuyprice = 240.00 , meanbuyprice = 240.00, lastbuyprice_withDiscount = 216.00, meanbuyprice_withDiscount = 216.00
        , lastbuyprice_withTax = 240, meanbuyprice_withTax = 240, lastbuyprice_withDiscountAndTax = 216
                where sellbilldetailid = 994;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1452, '2026-10-09', 718.39383492192, 720, 720
                    , 720, 648, 648, 648
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 720, 720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+718.39383492192, sellCostBuyPrice =sellCostBuyPrice+720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+648, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+648
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+648
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 718.39383492192, 720, 720
                    , 720, 648, 648, 648
                    , 0, 0, 0, 0
                    , 0, 0, 0, 720, 720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+718.39383492192, sellCostBuyPrice =sellCostBuyPrice+720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+648, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+648
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+648
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '3', storedetaildate = '2026-10-09 09:45:28' WHERE storedetailid = '1469';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1452', '1', '3', '1', '265', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '30', '3', '2026-10-09 09:45:28','0','0'); -- id=3826
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 200;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('207','01451', '265', '101', '1451', '12', '230', '2760', '0', '', '0', '2026-10-09 09:45:28', '1451', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','200-12,','1','1','0','0','230','2760','0','','0','0.00','0','0','0','0'); -- id=995
UPDATE sellbilldetail SET  lastbuyprice = 230.00 , meanbuyprice = 230.00, lastbuyprice_withDiscount = 207.00, meanbuyprice_withDiscount = 207.00
        , lastbuyprice_withTax = 230, meanbuyprice_withTax = 230, lastbuyprice_withDiscountAndTax = 207
                where sellbilldetailid = 995;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1451, '2026-10-09', 2753.8430338674, 2760, 2760
                    , 2760, 2484, 2484, 2484
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2753.8430338674, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2484, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2484
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2484
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2753.8430338674, 2760, 2760
                    , 2760, 2484, 2484, 2484
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2753.8430338674, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2484, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2484
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2484
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '3', storedetaildate = '2026-10-09 09:45:28' WHERE storedetailid = '1468';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1451', '1', '12', '1', '265', 'اضافة فاتورة مبيعات', 'sellbillController.php', '39', '27', '3', '2026-10-09 09:45:28','0','0'); -- id=3827
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1482215',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1457615','24600', '0', '2', 'اضافة فاتورة مبيعات', '265', '1482215', '2026-10-09 09:45:28', '3',  'sellbillController.php','1','','0'); -- id=310
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '24655', '24655', '2026-10-09', '3', '0', '0', '2026-10-09 09:45:28','اضافة فاتورة مبيعات رقم 265','1','0',null,'0','265','sellbillController.php?do=showDetail&sellbillid=265'); -- id=1651
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1651', '419', '24600', '','0'); -- id=1674
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1482215', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1651', '398', '55', '','0'); -- id=1675
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '137248', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1651', '143', '24655', '','0'); -- id=1651
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2862350', 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 ( '23007', '23007', '2026-10-09', '3', '0', '0', '2026-10-09 09:45:28','اضافة فاتورة مبيعات رقم 265 - صرف البضاعة من المخزن','1','0',null,'0','265','sellbillController.php?do=showDetail&sellbillid=265'); -- id=1652
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1652', '402', '23007', '','0'); -- id=1676
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2701010.29', 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 ('1652', '382', '23007', '','0'); -- id=1652
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20003057.91', 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='1651,0,1652' where sellbillid=265;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 24600, 23355, 23355
                    , 23355, 23007, 23007, 23007
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,23355, 23355, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+24600, sellCostBuyPrice =sellCostBuyPrice+23355
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+23355, sellCostMeanBuyPrice = sellCostMeanBuyPrice+23355
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+23007, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+23007
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+23007
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+23355
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+23355
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 24600, 23355, 23355
                    , 23355, 23007, 23007, 23007
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,23355, 23355, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+24600, sellCostBuyPrice =sellCostBuyPrice+23355
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+23355, sellCostMeanBuyPrice = sellCostMeanBuyPrice+23355
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+23007, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+23007
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+23007
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+23355
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+23355
                        , returnSellVal = returnSellVal+0, 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, 24600, 23355, 23355
                    , 23355, 23007, 23007, 23007, 23355, 23355)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+24600, netSellCostBuyPrice = netSellCostBuyPrice+23355
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+23355
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+23355
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+23007
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+23007
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+23007
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+23355
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+23355;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac887de7c7c0 and sellbillId = 265 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:15:28";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:45:28", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:45:28', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5528
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:15:33";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:45:33", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 09:45:33', '3', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5529
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:15:33";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:45:33", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 09:45:33', '3', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5530
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:15:36";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:45:36", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:45:36', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=265'); -- id=5531
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:16:01";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:46:01", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 09:46:01', '3', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5532
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:16:07";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:46:07", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 09:46:07', '2', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5533
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:16:15";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:46:15", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:46:15', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5534
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:16:20";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:46:20", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 09:46:20', '3', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5535
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:16:20";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 09:46:20', '3', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5536
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:16:33";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:46:33", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:46:33', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5537
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:16:33";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:46:33", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:46:33', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5538
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:17:32";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:17:36";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:47:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 09:47:36', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5539
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:17:36";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 09:47:36', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5540
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:17:43";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:47:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 09:47:43', '1', 'showbarcode', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=5541
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:17:52";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:47:52", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 09:47:52', '3', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5542
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:17:53";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:47:53", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 09:47:53', '3', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5543
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:17:56";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:47:56", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:47:56', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=249'); -- id=5544
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:20:23";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:50:23", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:50:23', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5545
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:20:23";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:50:23", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:50:23', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5546
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:21:47";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:51:47", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:51:47', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5547

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac88ae49ef32
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:51:47', '06ac88ae49ef32', '1', '0.00', '0', '0', '1', '29090.00', '29090', '29090', '0', '2', '2026-10-09 09:51:47', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '63' ,'0','','','','','-1','0','0','0','0','0','29090','0','','0','0','29090','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=266
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','266', '0', '2026-10-09 09:51:47', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '29090', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:51:47','0','0','',''); -- id=373
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+24 where id = 621;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('495','01722', '266', '49', '1722', '24', '550', '13200', '0', '', '0', '2026-10-09 09:51:47', '1722', '0.00', '0', '2','0.00','','','0','0','0','0','0','0','0','0','','621-24,','1','1','0','0','550','13200','0','','0','0.00','0','0','0','0'); -- id=996
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 495.00, meanbuyprice_withDiscount = 495.00
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 495
                where sellbilldetailid = 996;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1722, '2026-10-09', 13200, 13200, 13200
                    , 13200, 11880, 11880, 11880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24, 0, 13200, 13200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13200, sellCostBuyPrice =sellCostBuyPrice+13200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 13200, 13200, 13200
                    , 13200, 11880, 11880, 11880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13200, 13200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13200, sellCostBuyPrice =sellCostBuyPrice+13200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '63', userid = '4', storedetaildate = '2026-10-09 09:51:47' WHERE storedetailid = '2735';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1722', '2', '24', '1', '266', 'اضافة فاتورة مبيعات', 'sellbillController.php', '87', '63', '4', '2026-10-09 09:51:47','0','0'); -- id=3828
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 222;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('380','01441', '266', '88', '1441', '4', '410', '1640', '0', '', '0', '2026-10-09 09:51:47', '1441', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','222-4,','1','1','0','0','410','1640','0','','0','0.00','0','0','0','0'); -- id=997
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 997;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1441, '2026-10-09', 1640, 1520, 1520
                    , 1520, 1520, 1520, 1520
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1520, 1520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1640, sellCostBuyPrice =sellCostBuyPrice+1520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1640, 1520, 1520
                    , 1520, 1520, 1520, 1520
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1520, 1520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1640, sellCostBuyPrice =sellCostBuyPrice+1520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '4', storedetaildate = '2026-10-09 09:51:47' WHERE storedetailid = '1472';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1441', '2', '4', '1', '266', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '16', '4', '2026-10-09 09:51:47','0','0'); -- id=3829
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01324', '266', '86', '1324', '12', '390', '4680', '0', '', '0', '2026-10-09 09:51:47', '1324', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','131-12,','1','1','0','0','390','4680','0','','0','0.00','0','0','0','0'); -- id=998
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 998;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1324, '2026-10-09', 4680, 4200, 4200
                    , 4200, 4200, 4200, 4200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4200, 4200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4680, sellCostBuyPrice =sellCostBuyPrice+4200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-09', 4680, 4200, 4200
                    , 4200, 4200, 4200, 4200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4200, 4200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4680, sellCostBuyPrice =sellCostBuyPrice+4200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '720', userid = '4', storedetaildate = '2026-10-09 09:51:47' WHERE storedetailid = '1405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '2', '12', '1', '266', 'اضافة فاتورة مبيعات', 'sellbillController.php', '732', '720', '4', '2026-10-09 09:51:47','0','0'); -- id=3830
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where 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 ('390','01445', '266', '88', '1445', '8', '420', '3360', '0', '', '0', '2026-10-09 09:51:47', '1445', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','226-8,','1','1','0','0','420','3360','0','','0','0.00','0','0','0','0'); -- id=999
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 390.00
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 390
                where sellbilldetailid = 999;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1445, '2026-10-09', 3360, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 3360, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '4', storedetaildate = '2026-10-09 09:51:47' WHERE storedetailid = '1476';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1445', '2', '8', '1', '266', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16', '8', '4', '2026-10-09 09:51:47','0','0'); -- id=3831
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 133;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01325', '266', '87', '1325', '3', '390', '1170', '0', '', '0', '2026-10-09 09:51:47', '1325', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','133-3,','1','1','0','0','390','1170','0','','0','0.00','0','0','0','0'); -- id=1000
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1000;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1325, '2026-10-09', 1170, 1050, 1050
                    , 1050, 1050, 1050, 1050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1050, 1050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1170, 1050, 1050
                    , 1050, 1050, 1050, 1050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1050, 1050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '235', userid = '4', storedetaildate = '2026-10-09 09:51:47' WHERE storedetailid = '1406';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1325', '2', '3', '1', '266', 'اضافة فاتورة مبيعات', 'sellbillController.php', '238', '235', '4', '2026-10-09 09:51:47','0','0'); -- id=3832
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 221;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('390','01440', '266', '88', '1440', '8', '420', '3360', '0', '', '0', '2026-10-09 09:51:47', '1440', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','221-8,','1','1','0','0','420','3360','0','','0','0.00','0','0','0','0'); -- id=1001
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 390.00
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 390
                where sellbilldetailid = 1001;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1440, '2026-10-09', 3360, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 3360, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '56', userid = '4', storedetaildate = '2026-10-09 09:51:47' WHERE storedetailid = '1471';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1440', '2', '8', '1', '266', 'اضافة فاتورة مبيعات', 'sellbillController.php', '64', '56', '4', '2026-10-09 09:51:47','0','0'); -- id=3833
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 225;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('390','01444', '266', '88', '1444', '4', '420', '1680', '0', '', '0', '2026-10-09 09:51:47', '1444', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','225-4,','1','1','0','0','420','1680','0','','0','0.00','0','0','0','0'); -- id=1002
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 390.00
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 390
                where sellbilldetailid = 1002;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1444, '2026-10-09', 1680, 1560, 1560
                    , 1560, 1560, 1560, 1560
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1560, 1560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1680, sellCostBuyPrice =sellCostBuyPrice+1560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1560
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1680, 1560, 1560
                    , 1560, 1560, 1560, 1560
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1560, 1560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1680, sellCostBuyPrice =sellCostBuyPrice+1560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1560
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '4', storedetaildate = '2026-10-09 09:51:47' WHERE storedetailid = '1475';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1444', '2', '4', '1', '266', 'اضافة فاتورة مبيعات', 'sellbillController.php', '19', '15', '4', '2026-10-09 09:51:47','0','0'); -- id=3834
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '373930',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('344840','29090', '0', '3', 'اضافة فاتورة مبيعات', '266', '373930', '2026-10-09 09:51:47', '4',  'sellbillController.php','1','','0'); -- id=311
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '29090', '29090', '2026-10-09', '4', '0', '0', '2026-10-09 09:51:47','اضافة فاتورة مبيعات رقم 266','1','0',null,'0','266','sellbillController.php?do=showDetail&sellbillid=266'); -- id=1653
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1653', '501', '29090', '','0'); -- id=1677
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '373930', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1653', '143', '29090', '','0'); -- id=1653
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2891440', 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 ( '26450', '26450', '2026-10-09', '4', '0', '0', '2026-10-09 09:51:47','اضافة فاتورة مبيعات رقم 266 - صرف البضاعة من المخزن','1','0',null,'0','266','sellbillController.php?do=showDetail&sellbillid=266'); -- id=1654
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1654', '402', '26450', '','0'); -- id=1678
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2727460.29', 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 ('1654', '492', '26450', '','0'); -- id=1654
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '792305', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1653,0,1654' where sellbillid=266;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 29090, 27770, 27770
                    , 27770, 26450, 26450, 26450
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,27770, 27770, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+29090, sellCostBuyPrice =sellCostBuyPrice+27770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27770, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27770
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27770
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+27770
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 29090, 27770, 27770
                    , 27770, 26450, 26450, 26450
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,27770, 27770, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+29090, sellCostBuyPrice =sellCostBuyPrice+27770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27770, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27770
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27770
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+27770
                        , returnSellVal = returnSellVal+0, 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, 29090, 27770, 27770
                    , 27770, 26450, 26450, 26450, 27770, 27770)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+29090, netSellCostBuyPrice = netSellCostBuyPrice+27770
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+27770
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+27770
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+26450
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+26450
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+26450
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+27770
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+27770;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac88ae49ef32 and sellbillId = 266 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:21:47";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:51:47", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:51:47', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5548
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:22:08";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:52:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 09:52:08', '1', 'showbarcode', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=5549
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:23:50";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:53:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 09:53:50', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5550
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:23:50";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 09:53:50', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5551
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:23:53";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:53:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 09:53:53', '1', 'showbarcode', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=5552
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:24:12";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:54:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 09:54:12', '1', 'showbarcode', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=5553
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:24:17";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:54:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 09:54:17', '1', 'showbarcode', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=5554
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:24:56";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:54:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 09:54:56', '1', 'showbarcode', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=5555
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:25:57";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:55:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 09:55:57', '1', 'showbarcode', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=5556
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:26:15";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:56:15", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:56:15', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5557

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac88eaf79b88
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac88eaf79b88 and sellbillId = 267 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:26:15";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:56:15", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:56:15', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5558
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:26:24";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:56:24", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:56:24', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=267'); -- id=5559
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:27:13";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:57:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 09:57:13', '1', 'showbarcode', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=5560
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:27:40";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:57:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 09:57:40', '1', 'showbarcode', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=5561
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:27:57";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:57:57", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:57:57', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5562

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac88f04062c5
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:57:57', '06ac88f04062c5', '1', '0.00', '0', '0', '1', '3120.00', '3120', '3120', '0', '2', '2026-10-09 09:57:57', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '8' ,'0','','','','','-1','0','0','0','0','0','3120','0','','0','0','3120','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=268
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','268', '0', '2026-10-09 09:57:57', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3120', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:57:57','0','0','',''); -- id=375
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01324', '268', '86', '1324', '8', '390', '3120', '0', '', '0', '2026-10-09 09:57:57', '1324', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','131-8,','1','1','0','0','390','3120','0','','0','0.00','0','0','0','0'); -- id=1004
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1004;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1324, '2026-10-09', 3120, 2800, 2800
                    , 2800, 2800, 2800, 2800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3120, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 3120, 2800, 2800
                    , 2800, 2800, 2800, 2800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3120, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '712', userid = '4', storedetaildate = '2026-10-09 09:57:57' WHERE storedetailid = '1405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '2', '8', '1', '268', 'اضافة فاتورة مبيعات', 'sellbillController.php', '720', '712', '4', '2026-10-09 09:57:57','0','0'); -- id=3836
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '377050',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('373930','3120', '0', '3', 'اضافة فاتورة مبيعات', '268', '377050', '2026-10-09 09:57:57', '4',  'sellbillController.php','1','','0'); -- id=313
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3120', '3120', '2026-10-09', '4', '0', '0', '2026-10-09 09:57:57','اضافة فاتورة مبيعات رقم 268','1','0',null,'0','268','sellbillController.php?do=showDetail&sellbillid=268'); -- id=1657
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1657', '501', '3120', '','0'); -- id=1681
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '377050', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1657', '143', '3120', '','0'); -- id=1657
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2897830', 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 ( '2800', '2800', '2026-10-09', '4', '0', '0', '2026-10-09 09:57:57','اضافة فاتورة مبيعات رقم 268 - صرف البضاعة من المخزن','1','0',null,'0','268','sellbillController.php?do=showDetail&sellbillid=268'); -- id=1658
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1658', '402', '2800', '','0'); -- id=1682
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2733380.29', 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 ('1658', '492', '2800', '','0'); -- id=1658
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '789505', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1657,0,1658' where sellbillid=268;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 3120, 2800, 2800
                    , 2800, 2800, 2800, 2800
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3120, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3120, 2800, 2800
                    , 2800, 2800, 2800, 2800
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3120, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, 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, 3120, 2800, 2800
                    , 2800, 2800, 2800, 2800, 2800, 2800)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3120, netSellCostBuyPrice = netSellCostBuyPrice+2800
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2800
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2800
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2800
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2800
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2800
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2800
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2800;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac88f04062c5 and sellbillId = 268 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:27:57";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:57:57", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:57:57', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5563
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:27:58";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:57:58", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:57:58', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5564
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:28:20";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:58:20", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 09:58:20', '4', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5565
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:28:28";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:58:28", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:58:28', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5566
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:29:13";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:59:13", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:59:13', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5567

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac88db765507
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:59:13', '06ac88db765507', '1', '0.00', '0', '5', '1', '25105.00', '25100', '25100', '0', '1', '2026-10-09 09:59:13', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '73' ,'0','','','','','-1','0','0','0','0','0','25100','0','','0','0','25100','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=269
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','269', '0', '2026-10-09 09:59:13', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '25100', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:59:13','0','0','',''); -- id=376
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 505;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('362.7','01659', '269', '125', '1659', '3', '390', '1170', '0', '', '0', '2026-10-09 09:59:13', '1659', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','505-3,','1','1','0','0','390','1170','0','','0','0.00','0','0','0','0'); -- id=1005
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 362.70, meanbuyprice_withDiscount = 362.70
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 362.7
                where sellbilldetailid = 1005;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1659, '2026-10-09', 1169.7669786895, 1170, 1170
                    , 1170, 1088.1, 1088.1, 1088.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1169.7669786895, sellCostBuyPrice =sellCostBuyPrice+1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1088.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1088.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1088.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1170
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1169.7669786895, 1170, 1170
                    , 1170, 1088.1, 1088.1, 1088.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1169.7669786895, sellCostBuyPrice =sellCostBuyPrice+1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1088.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1088.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1088.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1170
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '204', userid = '2', storedetaildate = '2026-10-09 09:59:13' WHERE storedetailid = '2671';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1659', '1', '3', '1', '269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '207', '204', '2', '2026-10-09 09:59:13','0','0'); -- id=3837
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','01379', '269', '94', '1379', '9', '300', '2700', '0', '', '0', '2026-10-09 09:59:13', '1379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','71-9,','1','1','0','0','300','2700','0','','0','0.00','0','0','0','0'); -- id=1006
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1006;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-09', 2699.4622585142, 2430, 2430
                    , 2430, 2430, 2430, 2430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2430, 2430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2699.4622585142, sellCostBuyPrice =sellCostBuyPrice+2430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2699.4622585142, 2430, 2430
                    , 2430, 2430, 2430, 2430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2430, 2430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2699.4622585142, sellCostBuyPrice =sellCostBuyPrice+2430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '669', userid = '2', storedetaildate = '2026-10-09 09:59:13' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '9', '1', '269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '678', '669', '2', '2026-10-09 09:59:13','0','0'); -- id=3838
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','01379', '269', '94', '1379', '3', '300', '900', '0', '', '0', '2026-10-09 09:59:13', '1379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','71-3,','1','1','0','0','300','900','0','','0','0.00','0','0','0','0'); -- id=1007
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1007;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-09', 899.82075283808, 810, 810
                    , 810, 810, 810, 810
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 810, 810, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+899.82075283808, sellCostBuyPrice =sellCostBuyPrice+810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+810, sellCostMeanBuyPrice = sellCostMeanBuyPrice+810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+810
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+810
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+810
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 899.82075283808, 810, 810
                    , 810, 810, 810, 810
                    , 0, 0, 0, 0
                    , 0, 0, 0, 810, 810, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+899.82075283808, sellCostBuyPrice =sellCostBuyPrice+810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+810, sellCostMeanBuyPrice = sellCostMeanBuyPrice+810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+810
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+810
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+810
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '666', userid = '2', storedetaildate = '2026-10-09 09:59:13' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '3', '1', '269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '669', '666', '2', '2026-10-09 09:59:13','0','0'); -- id=3839
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+18 where id = 282;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('288','01472', '269', '105', '1472', '18', '320', '5760', '0', '', '0', '2026-10-09 09:59:13', '1472', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','282-18,','1','1','0','0','320','5760','0','','0','0.00','0','0','0','0'); -- id=1008
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 288.00, meanbuyprice_withDiscount = 288.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 288
                where sellbilldetailid = 1008;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1472, '2026-10-09', 5758.8528181637, 5760, 5760
                    , 5760, 5184, 5184, 5184
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 0, 5760, 5760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5758.8528181637, sellCostBuyPrice =sellCostBuyPrice+5760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5184, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5184
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5184
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+18
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5758.8528181637, 5760, 5760
                    , 5760, 5184, 5184, 5184
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5760, 5760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5758.8528181637, sellCostBuyPrice =sellCostBuyPrice+5760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5184, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5184
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5184
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '72', userid = '2', storedetaildate = '2026-10-09 09:59:13' WHERE storedetailid = '1497';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1472', '1', '18', '1', '269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '90', '72', '2', '2026-10-09 09:59:13','0','0'); -- id=3840
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 74;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','01382', '269', '94', '1382', '6', '400', '2400', '0', '', '0', '2026-10-09 09:59:13', '1382', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','74-6,','1','1','0','0','400','2400','0','','0','0.00','0','0','0','0'); -- id=1009
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1009;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1382, '2026-10-09', 2399.5220075682, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2399.5220075682, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2399.5220075682, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2399.5220075682, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '144', userid = '2', storedetaildate = '2026-10-09 09:59:13' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '6', '1', '269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '150', '144', '2', '2026-10-09 09:59:13','0','0'); -- id=3841
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 72;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01380', '269', '94', '1380', '6', '390', '2340', '0', '', '0', '2026-10-09 09:59:13', '1380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','72-6,','1','1','0','0','390','2340','0','','0','0.00','0','0','0','0'); -- id=1010
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1010;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-09', 2339.533957379, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2339.533957379, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2339.533957379, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2339.533957379, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '642', userid = '2', storedetaildate = '2026-10-09 09:59:13' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '6', '1', '269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '648', '642', '2', '2026-10-09 09:59:13','0','0'); -- id=3842
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 72;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01380', '269', '94', '1380', '9', '390', '3510', '0', '', '0', '2026-10-09 09:59:13', '1380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','72-9,','1','1','0','0','390','3510','0','','0','0.00','0','0','0','0'); -- id=1011
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1011;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-09', 3509.3009360685, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3509.3009360685, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3509.3009360685, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3509.3009360685, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '633', userid = '2', storedetaildate = '2026-10-09 09:59:13' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '9', '1', '269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '642', '633', '2', '2026-10-09 09:59:13','0','0'); -- id=3843
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 73;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('260','01381', '269', '94', '1381', '3', '295', '885', '0', '', '0', '2026-10-09 09:59:13', '1381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','73-3,','1','1','0','0','295','885','0','','0','0.00','0','0','0','0'); -- id=1012
UPDATE sellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.00
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260, lastbuyprice_withDiscountAndTax = 260
                where sellbilldetailid = 1012;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1381, '2026-10-09', 884.82374029078, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+884.82374029078, sellCostBuyPrice =sellCostBuyPrice+780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 884.82374029078, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+884.82374029078, 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 = '312', userid = '2', storedetaildate = '2026-10-09 09:59:13' WHERE storedetailid = '1381';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1381', '1', '3', '1', '269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '315', '312', '2', '2026-10-09 09:59:13','0','0'); -- id=3844
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+16 where id = 355;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('276','01467', '269', '104', '1467', '16', '340', '5440', '0', '', '0', '2026-10-09 09:59:13', '1467', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','355-16,','1','1','0','0','340','5440','0','','0','0.00','0','0','0','0'); -- id=1013
UPDATE sellbilldetail SET  lastbuyprice = 276.00 , meanbuyprice = 276.00, lastbuyprice_withDiscount = 276.00, meanbuyprice_withDiscount = 276.00
        , lastbuyprice_withTax = 276, meanbuyprice_withTax = 276, lastbuyprice_withDiscountAndTax = 276
                where sellbilldetailid = 1013;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1467, '2026-10-09', 5438.916550488, 4416, 4416
                    , 4416, 4416, 4416, 4416
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 4416, 4416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5438.916550488, sellCostBuyPrice =sellCostBuyPrice+4416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4416, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4416
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5438.916550488, 4416, 4416
                    , 4416, 4416, 4416, 4416
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4416, 4416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5438.916550488, sellCostBuyPrice =sellCostBuyPrice+4416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4416, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4416
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '740', userid = '2', storedetaildate = '2026-10-09 09:59:13' WHERE storedetailid = '1492';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1467', '1', '16', '1', '269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '756', '740', '2', '2026-10-09 09:59:13','0','0'); -- id=3845
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1510585',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1485485','25100', '0', '2', 'اضافة فاتورة مبيعات', '269', '1510585', '2026-10-09 09:59:13', '2',  'sellbillController.php','1','','0'); -- id=314
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '25105', '25105', '2026-10-09', '2', '0', '0', '2026-10-09 09:59:13','اضافة فاتورة مبيعات رقم 269','1','0',null,'0','269','sellbillController.php?do=showDetail&sellbillid=269'); -- id=1659
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1659', '419', '25100', '','0'); -- id=1683
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1510585', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1659', '398', '5', '','0'); -- id=1684
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '137253', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1659', '143', '25105', '','0'); -- id=1659
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2922935', 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 ( '22118.1', '22118.1', '2026-10-09', '2', '0', '0', '2026-10-09 09:59:13','اضافة فاتورة مبيعات رقم 269 - صرف البضاعة من المخزن','1','0',null,'0','269','sellbillController.php?do=showDetail&sellbillid=269'); -- id=1660
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1660', '402', '22118.1', '','0'); -- id=1685
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2755498.39', 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 ('1660', '382', '22118.1', '','0'); -- id=1660
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19977819.81', 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='1659,0,1660' where sellbillid=269;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 25100, 22776, 22776
                    , 22776, 22118.1, 22118.1, 22118.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,22776, 22776, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+25100, sellCostBuyPrice =sellCostBuyPrice+22776
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22776, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22776
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22118.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22118.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22118.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22776
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22776
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 25100, 22776, 22776
                    , 22776, 22118.1, 22118.1, 22118.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,22776, 22776, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+25100, sellCostBuyPrice =sellCostBuyPrice+22776
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22776, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22776
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22118.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22118.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22118.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22776
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22776
                        , returnSellVal = returnSellVal+0, 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, 25100, 22776, 22776
                    , 22776, 22118.1, 22118.1, 22118.1, 22776, 22776)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+25100, netSellCostBuyPrice = netSellCostBuyPrice+22776
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+22776
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+22776
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+22118.1
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+22118.1
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+22118.1
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+22776
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+22776;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac88db765507 and sellbillId = 269 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:29:13";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:59:13", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:59:13', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5568
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:29:31";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:59:31", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:59:31', '2', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=269'); -- id=5569
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:29:44";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:59:44", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:59:44', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5570
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:29:45";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:59:45", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 09:59:45', '3', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5571
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:29:45";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:59:45", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 09:59:45', '3', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5572
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:29:53";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:59:53", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:59:53', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5573
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:29:53";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 09:59:53", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 09:59:53', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5574
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:31:00";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:31:02";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:01:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 10:01:02', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5575
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:31:02";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 10:01:02', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5576
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:31:08";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:01:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 10:01:08', '1', 'showbarcode', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=5577
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:35:05";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:05:05", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:05:05', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5578

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac890e9813f3
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 10:05:05', '06ac890e9813f3', '1', '0.00', '0', '0', '1', '13710.00', '13710', '13710', '0', '1', '2026-10-09 10:05:05', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '46' ,'0','','','','','-1','0','0','0','0','0','13710','0','','0','0','13710','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=270
UPDATE client SET  clientdebt = '0', userid = '3' 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','اضافة فاتورة مبيعات','270', '0', '2026-10-09 10:05:06', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '13710', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:05:05','0','0','',''); -- id=377
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','01379', '270', '94', '1379', '12', '300', '3600', '0', '', '0', '2026-10-09 10:05:06', '1379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','71-12,','1','1','0','0','300','3600','0','','0','0.00','0','0','0','0'); -- id=1014
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1014;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-09', 3600, 3240, 3240
                    , 3240, 3240, 3240, 3240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3600, 3240, 3240
                    , 3240, 3240, 3240, 3240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '654', userid = '3', storedetaildate = '2026-10-09 10:05:06' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '12', '1', '270', 'اضافة فاتورة مبيعات', 'sellbillController.php', '666', '654', '3', '2026-10-09 10:05:06','0','0'); -- id=3846
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+18 where id = 73;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('260','01381', '270', '94', '1381', '18', '295', '5310', '0', '', '0', '2026-10-09 10:05:06', '1381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','73-18,','1','1','0','0','295','5310','0','','0','0.00','0','0','0','0'); -- id=1015
UPDATE sellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.00
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260, lastbuyprice_withDiscountAndTax = 260
                where sellbilldetailid = 1015;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1381, '2026-10-09', 5310, 4680, 4680
                    , 4680, 4680, 4680, 4680
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 0, 4680, 4680, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5310, sellCostBuyPrice =sellCostBuyPrice+4680
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4680, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4680
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4680, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4680
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4680
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4680
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4680
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+18
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5310, 4680, 4680
                    , 4680, 4680, 4680, 4680
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4680, 4680, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5310, sellCostBuyPrice =sellCostBuyPrice+4680
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4680, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4680
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4680, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4680
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4680
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4680
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4680
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '294', userid = '3', storedetaildate = '2026-10-09 10:05:06' WHERE storedetailid = '1381';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1381', '1', '18', '1', '270', 'اضافة فاتورة مبيعات', 'sellbillController.php', '312', '294', '3', '2026-10-09 10:05:06','0','0'); -- id=3847
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+16 where id = 664;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('280','01750', '270', '134', '1750', '16', '300', '4800', '0', '', '0', '2026-10-09 10:05:06', '1750', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','664-16,','1','1','0','0','300','4800','0','','0','0.00','0','0','0','0'); -- id=1016
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 280.00, lastbuyprice_withDiscount = 280.00, meanbuyprice_withDiscount = 280.00
        , lastbuyprice_withTax = 280, meanbuyprice_withTax = 140, lastbuyprice_withDiscountAndTax = 280
                where sellbilldetailid = 1016;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1750, '2026-10-09', 4800, 4480, 4480
                    , 4480, 4480, 4480, 4480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 4480, 2240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4800, sellCostBuyPrice =sellCostBuyPrice+4480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4800, 4480, 4480
                    , 4480, 4480, 4480, 4480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4480, 2240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4800, sellCostBuyPrice =sellCostBuyPrice+4480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '3', storedetaildate = '2026-10-09 10:05:06' WHERE storedetailid = '2763';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1750', '1', '16', '1', '270', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '8', '3', '2026-10-09 10:05:06','0','0'); -- id=3848
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1524295',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1510585','13710', '0', '2', 'اضافة فاتورة مبيعات', '270', '1524295', '2026-10-09 10:05:06', '3',  'sellbillController.php','1','','0'); -- id=315
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '13710', '13710', '2026-10-09', '3', '0', '0', '2026-10-09 10:05:06','اضافة فاتورة مبيعات رقم 270','1','0',null,'0','270','sellbillController.php?do=showDetail&sellbillid=270'); -- id=1661
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1661', '419', '13710', '','0'); -- id=1686
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1524295', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1661', '143', '13710', '','0'); -- id=1661
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2936645', 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 ( '12400', '12400', '2026-10-09', '3', '0', '0', '2026-10-09 10:05:06','اضافة فاتورة مبيعات رقم 270 - صرف البضاعة من المخزن','1','0',null,'0','270','sellbillController.php?do=showDetail&sellbillid=270'); -- id=1662
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1662', '402', '12400', '','0'); -- id=1687
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2767898.39', 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 ('1662', '382', '12400', '','0'); -- id=1662
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19965419.81', 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='1661,0,1662' where sellbillid=270;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 13710, 12400, 12400
                    , 12400, 12400, 12400, 12400
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12400, 10160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13710, sellCostBuyPrice =sellCostBuyPrice+12400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 13710, 12400, 12400
                    , 12400, 12400, 12400, 12400
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12400, 10160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13710, sellCostBuyPrice =sellCostBuyPrice+12400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10160
                        , returnSellVal = returnSellVal+0, 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, 13710, 12400, 12400
                    , 12400, 12400, 12400, 12400, 12400, 10160)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+13710, netSellCostBuyPrice = netSellCostBuyPrice+12400
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+12400
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+12400
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+12400
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+12400
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+12400
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+12400
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+10160;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac890e9813f3 and sellbillId = 270 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:35:06";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:05:06", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:05:06', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5579
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:35:10";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:05:10", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:05:10', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=270'); -- id=5580
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:35:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:05:32", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:05:32', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5581
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:35:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:05:32", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:05:32', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5582
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:46:25";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:16:25", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:16:25', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5583

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8923cf047b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 10:16:25', '06ac8923cf047b', '1', '0.00', '0', '15', '1', '57015.00', '57000', '57000', '0', '1', '2026-10-09 10:16:25', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '125' ,'0','','','','','-1','0','0','0','0','0','57000','0','','0','0','57000','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=271
UPDATE client SET  clientdebt = '0', userid = '3' 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','اضافة فاتورة مبيعات','271', '0', '2026-10-09 10:16:25', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '57000', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:16:25','0','0','',''); -- id=378
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 546;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','01644', '271', '122', '1644', '6', '460', '2760', '0', '', '0', '2026-10-09 10:16:25', '1644', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','546-6,','1','1','0','0','460','2760','0','','0','0.00','0','0','0','0'); -- id=1017
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1017;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1644, '2026-10-09', 2759.273875296, 2760, 2760
                    , 2760, 2484, 2484, 2484
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2759.273875296, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2484, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2484
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2484
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2759.273875296, 2760, 2760
                    , 2760, 2484, 2484, 2484
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2759.273875296, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2484, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2484
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2484
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '3', storedetaildate = '2026-10-09 10:16:25' WHERE storedetailid = '1669';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1644', '1', '6', '1', '271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '12', '3', '2026-10-09 10:16:25','0','0'); -- id=3849
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 329;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','01459', '271', '103', '1459', '6', '330', '1980', '0', '', '0', '2026-10-09 10:16:25', '1459', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','329-6,','1','1','0','0','330','1980','0','','0','0.00','0','0','0','0'); -- id=1018
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 1018;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1459, '2026-10-09', 1979.4790844515, 1860, 1860
                    , 1860, 1860, 1860, 1860
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1860, 1860, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1979.4790844515, sellCostBuyPrice =sellCostBuyPrice+1860
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1860, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1860
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1860, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1860
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1860
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1860
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1860
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1979.4790844515, 1860, 1860
                    , 1860, 1860, 1860, 1860
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1860, 1860, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1979.4790844515, sellCostBuyPrice =sellCostBuyPrice+1860
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1860, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1860
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1860, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1860
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1860
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1860
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1860
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '37', userid = '3', storedetaildate = '2026-10-09 10:16:25' WHERE storedetailid = '1484';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1459', '1', '6', '1', '271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '43', '37', '3', '2026-10-09 10:16:25','0','0'); -- id=3850
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 297;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('333','01519', '271', '111', '1519', '6', '370', '2220', '0', '', '0', '2026-10-09 10:16:25', '1519', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','297-6,','1','1','0','0','370','2220','0','','0','0.00','0','0','0','0'); -- id=1019
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 333.00, meanbuyprice_withDiscount = 333.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 333
                where sellbilldetailid = 1019;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1519, '2026-10-09', 2219.4159431728, 2220, 2220
                    , 2220, 1998, 1998, 1998
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2219.4159431728, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1998, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1998
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1998
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2219.4159431728, 2220, 2220
                    , 2220, 1998, 1998, 1998
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2219.4159431728, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1998, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1998
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1998
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '3', storedetaildate = '2026-10-09 10:16:25' WHERE storedetailid = '1544';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1519', '1', '6', '1', '271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '15', '3', '2026-10-09 10:16:25','0','0'); -- id=3851
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+18 where id = 580;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('520','01717', '271', '131', '1717', '18', '545', '9810', '0', '', '0', '2026-10-09 10:16:25', '1717', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','580-18,','1','1','0','0','545','9810','0','','0','0.00','0','0','0','0'); -- id=1020
UPDATE sellbilldetail SET  lastbuyprice = 520.00 , meanbuyprice = 520.00, lastbuyprice_withDiscount = 520.00, meanbuyprice_withDiscount = 520.00
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 520
                where sellbilldetailid = 1020;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1717, '2026-10-09', 9807.4191002368, 9360, 9360
                    , 9360, 9360, 9360, 9360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 0, 9360, 9360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9807.4191002368, sellCostBuyPrice =sellCostBuyPrice+9360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+18
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 9807.4191002368, 9360, 9360
                    , 9360, 9360, 9360, 9360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9360, 9360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9807.4191002368, sellCostBuyPrice =sellCostBuyPrice+9360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '114', userid = '3', storedetaildate = '2026-10-09 10:16:25' WHERE storedetailid = '2729';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1717', '1', '18', '1', '271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '132', '114', '3', '2026-10-09 10:16:25','0','0'); -- id=3852
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 521;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('478.4','01672', '271', '124', '1672', '6', '520', '3120', '0', '', '0', '2026-10-09 10:16:25', '1672', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','521-6,','1','1','0','0','520','3120','0','','0','0.00','0','0','0','0'); -- id=1021
UPDATE sellbilldetail SET  lastbuyprice = 520.00 , meanbuyprice = 520.00, lastbuyprice_withDiscount = 478.40, meanbuyprice_withDiscount = 478.40
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 478.4
                where sellbilldetailid = 1021;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1672, '2026-10-09', 3119.1791633781, 3120, 3120
                    , 3120, 2870.4, 2870.4, 2870.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3119.1791633781, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2870.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2870.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2870.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3119.1791633781, 3120, 3120
                    , 3120, 2870.4, 2870.4, 2870.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3119.1791633781, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2870.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2870.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2870.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '3', storedetaildate = '2026-10-09 10:16:25' WHERE storedetailid = '2684';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1672', '1', '6', '1', '271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '24', '3', '2026-10-09 10:16:25','0','0'); -- id=3853
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+21 where id = 74;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','01382', '271', '94', '1382', '21', '400', '8400', '0', '', '0', '2026-10-09 10:16:25', '1382', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','74-21,','1','1','0','0','400','8400','0','','0','0.00','0','0','0','0'); -- id=1022
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1022;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1382, '2026-10-09', 8397.7900552486, 7560, 7560
                    , 7560, 7560, 7560, 7560
                    , 0, 0, 0, 0
                    , 0, 0, 0, 21, 0, 7560, 7560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8397.7900552486, sellCostBuyPrice =sellCostBuyPrice+7560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7560
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+21
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 8397.7900552486, 7560, 7560
                    , 7560, 7560, 7560, 7560
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7560, 7560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8397.7900552486, sellCostBuyPrice =sellCostBuyPrice+7560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7560
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '123', userid = '3', storedetaildate = '2026-10-09 10:16:25' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '21', '1', '271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '144', '123', '3', '2026-10-09 10:16:25','0','0'); -- id=3854
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+21 where id = 581;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('510','01718', '271', '131', '1718', '21', '535', '11235', '0', '', '0', '2026-10-09 10:16:25', '1718', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','581-21,','1','1','0','0','535','11235','0','','0','0.00','0','0','0','0'); -- id=1023
UPDATE sellbilldetail SET  lastbuyprice = 510.00 , meanbuyprice = 510.00, lastbuyprice_withDiscount = 510.00, meanbuyprice_withDiscount = 510.00
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 510
                where sellbilldetailid = 1023;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1718, '2026-10-09', 11232.044198895, 10710, 10710
                    , 10710, 10710, 10710, 10710
                    , 0, 0, 0, 0
                    , 0, 0, 0, 21, 0, 10710, 10710, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11232.044198895, sellCostBuyPrice =sellCostBuyPrice+10710
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10710, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10710
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10710, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10710
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10710
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10710
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10710
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+21
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 11232.044198895, 10710, 10710
                    , 10710, 10710, 10710, 10710
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10710, 10710, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11232.044198895, sellCostBuyPrice =sellCostBuyPrice+10710
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10710, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10710
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10710, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10710
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10710
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10710
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10710
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '162', userid = '3', storedetaildate = '2026-10-09 10:16:25' WHERE storedetailid = '2730';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1718', '1', '21', '1', '271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '183', '162', '3', '2026-10-09 10:16:25','0','0'); -- id=3855
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 355;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('276','01467', '271', '104', '1467', '12', '340', '4080', '0', '', '0', '2026-10-09 10:16:25', '1467', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','355-12,','1','1','0','0','340','4080','0','','0','0.00','0','0','0','0'); -- id=1024
UPDATE sellbilldetail SET  lastbuyprice = 276.00 , meanbuyprice = 276.00, lastbuyprice_withDiscount = 276.00, meanbuyprice_withDiscount = 276.00
        , lastbuyprice_withTax = 276, meanbuyprice_withTax = 276, lastbuyprice_withDiscountAndTax = 276
                where sellbilldetailid = 1024;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1467, '2026-10-09', 4078.9265982636, 3312, 3312
                    , 3312, 3312, 3312, 3312
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3312, 3312, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4078.9265982636, sellCostBuyPrice =sellCostBuyPrice+3312
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3312, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3312
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3312, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3312
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3312
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3312
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3312
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4078.9265982636, 3312, 3312
                    , 3312, 3312, 3312, 3312
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3312, 3312, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4078.9265982636, sellCostBuyPrice =sellCostBuyPrice+3312
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3312, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3312
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3312, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3312
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3312
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3312
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3312
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '728', userid = '3', storedetaildate = '2026-10-09 10:16:25' WHERE storedetailid = '1492';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1467', '1', '12', '1', '271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '740', '728', '3', '2026-10-09 10:16:25','0','0'); -- id=3856
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 542;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('288','01640', '271', '122', '1640', '6', '320', '1920', '0', '', '0', '2026-10-09 10:16:25', '1640', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','542-6,','1','1','0','0','320','1920','0','','0','0.00','0','0','0','0'); -- id=1025
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 288.00, meanbuyprice_withDiscount = 288.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 288
                where sellbilldetailid = 1025;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1640, '2026-10-09', 1919.4948697711, 1920, 1920
                    , 1920, 1728, 1728, 1728
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1920, 1920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1919.4948697711, sellCostBuyPrice =sellCostBuyPrice+1920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1728, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1728
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1728
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1919.4948697711, 1920, 1920
                    , 1920, 1728, 1728, 1728
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1920, 1920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1919.4948697711, sellCostBuyPrice =sellCostBuyPrice+1920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1728, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1728
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1728
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '3', storedetaildate = '2026-10-09 10:16:25' WHERE storedetailid = '1665';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1640', '1', '6', '1', '271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '15', '3', '2026-10-09 10:16:25','0','0'); -- id=3857
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 327;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','01457', '271', '103', '1457', '9', '450', '4050', '0', '', '0', '2026-10-09 10:16:25', '1457', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','327-9,','1','1','0','0','450','4050','0','','0','0.00','0','0','0','0'); -- id=1026
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 1026;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1457, '2026-10-09', 4048.9344909234, 3870, 3870
                    , 3870, 3870, 3870, 3870
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4048.9344909234, sellCostBuyPrice =sellCostBuyPrice+3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4048.9344909234, 3870, 3870
                    , 3870, 3870, 3870, 3870
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4048.9344909234, sellCostBuyPrice =sellCostBuyPrice+3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '3', storedetaildate = '2026-10-09 10:16:25' WHERE storedetailid = '1482';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1457', '1', '9', '1', '271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '12', '3', '2026-10-09 10:16:25','0','0'); -- id=3858
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 510;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('515.2','01661', '271', '124', '1661', '6', '560', '3360', '0', '', '0', '2026-10-09 10:16:25', '1661', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','510-6,','1','1','0','0','560','3360','0','','0','0.00','0','0','0','0'); -- id=1027
UPDATE sellbilldetail SET  lastbuyprice = 560.00 , meanbuyprice = 560.00, lastbuyprice_withDiscount = 515.20, meanbuyprice_withDiscount = 515.20
        , lastbuyprice_withTax = 560, meanbuyprice_withTax = 560, lastbuyprice_withDiscountAndTax = 515.2
                where sellbilldetailid = 1027;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1661, '2026-10-09', 3359.1160220994, 3360, 3360
                    , 3360, 3091.2, 3091.2, 3091.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3360, 3360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3359.1160220994, sellCostBuyPrice =sellCostBuyPrice+3360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3091.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3091.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3091.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3359.1160220994, 3360, 3360
                    , 3360, 3091.2, 3091.2, 3091.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3360, 3360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3359.1160220994, sellCostBuyPrice =sellCostBuyPrice+3360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3091.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3091.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3091.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '3', storedetaildate = '2026-10-09 10:16:25' WHERE storedetailid = '2673';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1661', '1', '6', '1', '271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '15', '3', '2026-10-09 10:16:25','0','0'); -- id=3859
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 670;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('490','01756', '271', '134', '1756', '8', '510', '4080', '0', '', '0', '2026-10-09 10:16:25', '1756', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','670-8,','1','1','0','0','510','4080','0','','0','0.00','0','0','0','0'); -- id=1028
UPDATE sellbilldetail SET  lastbuyprice = 490.00 , meanbuyprice = 490.00, lastbuyprice_withDiscount = 490.00, meanbuyprice_withDiscount = 490.00
        , lastbuyprice_withTax = 490, meanbuyprice_withTax = 245, lastbuyprice_withDiscountAndTax = 490
                where sellbilldetailid = 1028;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1756, '2026-10-09', 4078.9265982636, 3920, 3920
                    , 3920, 3920, 3920, 3920
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 3920, 1960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4078.9265982636, sellCostBuyPrice =sellCostBuyPrice+3920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3920, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3920
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3920
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4078.9265982636, 3920, 3920
                    , 3920, 3920, 3920, 3920
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3920, 1960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4078.9265982636, sellCostBuyPrice =sellCostBuyPrice+3920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3920, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3920
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3920
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '3', storedetaildate = '2026-10-09 10:16:25' WHERE storedetailid = '2769';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1756', '1', '8', '1', '271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '12', '3', '2026-10-09 10:16:25','0','0'); -- id=3860
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1581295',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1524295','57000', '0', '2', 'اضافة فاتورة مبيعات', '271', '1581295', '2026-10-09 10:16:25', '3',  'sellbillController.php','1','','0'); -- id=316
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '57015', '57015', '2026-10-09', '3', '0', '0', '2026-10-09 10:16:25','اضافة فاتورة مبيعات رقم 271','1','0',null,'0','271','sellbillController.php?do=showDetail&sellbillid=271'); -- id=1663
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1663', '419', '57000', '','0'); -- id=1688
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1581295', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1663', '398', '15', '','0'); -- id=1689
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '137268', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1663', '143', '57015', '','0'); -- id=1663
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2993660', 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 ( '52763.6', '52763.6', '2026-10-09', '3', '0', '0', '2026-10-09 10:16:25','اضافة فاتورة مبيعات رقم 271 - صرف البضاعة من المخزن','1','0',null,'0','271','sellbillController.php?do=showDetail&sellbillid=271'); -- id=1664
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1664', '402', '52763.6', '','0'); -- id=1690
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2820661.99', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1664', '382', '52763.6', '','0'); -- id=1664
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19912656.21', 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='1663,0,1664' where sellbillid=271;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 57000, 53972, 53972
                    , 53972, 52763.6, 52763.6, 52763.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,53972, 52012, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+57000, sellCostBuyPrice =sellCostBuyPrice+53972
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+53972, sellCostMeanBuyPrice = sellCostMeanBuyPrice+53972
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52763.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52763.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52763.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+53972
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52012
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 57000, 53972, 53972
                    , 53972, 52763.6, 52763.6, 52763.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,53972, 52012, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+57000, sellCostBuyPrice =sellCostBuyPrice+53972
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+53972, sellCostMeanBuyPrice = sellCostMeanBuyPrice+53972
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52763.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52763.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52763.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+53972
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52012
                        , returnSellVal = returnSellVal+0, 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, 57000, 53972, 53972
                    , 53972, 52763.6, 52763.6, 52763.6, 53972, 52012)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+57000, netSellCostBuyPrice = netSellCostBuyPrice+53972
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+53972
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+53972
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+52763.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+52763.6
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+52763.6
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+53972
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+52012;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8923cf047b and sellbillId = 271 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:46:25";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:16:25", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:16:25', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5584
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:46:29";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:16:29", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:16:29', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=271'); -- id=5585
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:46:59";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:16:59", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:16:59', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5586
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:47:00";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:17:00", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:17:00', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5587
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:47:56";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:17:56", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:17:56', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5588

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8909491cc0
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 10:17:56', '06ac8909491cc0', '1', '0.00', '0', '0', '1', '2520.00', '2520', '2520', '0', '2', '2026-10-09 10:17:56', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '6' ,'0','','','','','-1','0','0','0','0','0','2520','0','','0','0','2520','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=272
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','272', '0', '2026-10-09 10:17:56', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2520', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:17:56','0','0','',''); -- id=379
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 135;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('380','01326', '272', '87', '1326', '6', '420', '2520', '0', '', '0', '2026-10-09 10:17:56', '1326', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','135-6,','1','1','0','0','420','2520','0','','0','0.00','0','0','0','0'); -- id=1029
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 1029;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1326, '2026-10-09', 2520, 2280, 2280
                    , 2280, 2280, 2280, 2280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2280, 2280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 2520, 2280, 2280
                    , 2280, 2280, 2280, 2280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2280, 2280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '171', userid = '4', storedetaildate = '2026-10-09 10:17:56' WHERE storedetailid = '1407';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1326', '2', '6', '1', '272', 'اضافة فاتورة مبيعات', 'sellbillController.php', '177', '171', '4', '2026-10-09 10:17:56','0','0'); -- id=3861
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '379570',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('377050','2520', '0', '3', 'اضافة فاتورة مبيعات', '272', '379570', '2026-10-09 10:17:56', '4',  'sellbillController.php','1','','0'); -- id=317
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2520', '2520', '2026-10-09', '4', '0', '0', '2026-10-09 10:17:56','اضافة فاتورة مبيعات رقم 272','1','0',null,'0','272','sellbillController.php?do=showDetail&sellbillid=272'); -- id=1665
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1665', '501', '2520', '','0'); -- id=1691
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '379570', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1665', '143', '2520', '','0'); -- id=1665
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2996180', 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 ( '2280', '2280', '2026-10-09', '4', '0', '0', '2026-10-09 10:17:56','اضافة فاتورة مبيعات رقم 272 - صرف البضاعة من المخزن','1','0',null,'0','272','sellbillController.php?do=showDetail&sellbillid=272'); -- id=1666
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1666', '402', '2280', '','0'); -- id=1692
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2822941.99', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1666', '492', '2280', '','0'); -- id=1666
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '787225', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1665,0,1666' where sellbillid=272;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 2520, 2280, 2280
                    , 2280, 2280, 2280, 2280
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2280, 2280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2520, 2280, 2280
                    , 2280, 2280, 2280, 2280
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2280, 2280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2280
                        , returnSellVal = returnSellVal+0, 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, 2520, 2280, 2280
                    , 2280, 2280, 2280, 2280, 2280, 2280)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2520, netSellCostBuyPrice = netSellCostBuyPrice+2280
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2280
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2280
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2280
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2280
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2280
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2280
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2280;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8909491cc0 and sellbillId = 272 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:47:56";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:17:56", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:17:56', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5589
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:48:16";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:18:16", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 10:18:16', '4', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5590
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:48:20";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:18:20", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:18:20', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5591
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:48:47";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:18:47", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 10:18:47', '4', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5592
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:49:27";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:19:27", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:19:27', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5593
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:52:51";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:22:51", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:22:51', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5594

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac890e0bafe1
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac890e0bafe1 and sellbillId = 273 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:52:52";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:22:52", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:22:52', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5595
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:54:40";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:24:40", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:24:40', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5596

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac894ec2a559
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 10:24:40', '06ac894ec2a559', '1', '0.00', '0', '0', '1', '2160.00', '2160', '2160', '0', '1', '2026-10-09 10:24:40', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '6' ,'0','','','','','-1','0','0','0','0','0','2160','0','','0','0','2160','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=274
UPDATE client SET  clientdebt = '0', userid = '3' 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','اضافة فاتورة مبيعات','274', '0', '2026-10-09 10:24:40', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2160', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:24:40','0','0','',''); -- id=381
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 581;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('510','01718', '274', '131', '1718', '3', '535', '1605', '0', '', '0', '2026-10-09 10:24:40', '1718', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','581-3,','1','1','0','0','535','1605','0','','0','0.00','0','0','0','0'); -- id=1031
UPDATE sellbilldetail SET  lastbuyprice = 510.00 , meanbuyprice = 510.00, lastbuyprice_withDiscount = 510.00, meanbuyprice_withDiscount = 510.00
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 510
                where sellbilldetailid = 1031;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1718, '2026-10-09', 1605, 1530, 1530
                    , 1530, 1530, 1530, 1530
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1530, 1530, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1605, sellCostBuyPrice =sellCostBuyPrice+1530
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1530, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1530
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1530
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1530
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1530
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1530
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1605, 1530, 1530
                    , 1530, 1530, 1530, 1530
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1530, 1530, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1605, sellCostBuyPrice =sellCostBuyPrice+1530
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1530, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1530
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1530
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1530
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1530
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1530
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '159', userid = '3', storedetaildate = '2026-10-09 10:24:40' WHERE storedetailid = '2730';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1718', '1', '3', '1', '274', 'اضافة فاتورة مبيعات', 'sellbillController.php', '162', '159', '3', '2026-10-09 10:24:40','0','0'); -- id=3863
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 198;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('166.5','01449', '274', '101', '1449', '3', '185', '555', '0', '', '0', '2026-10-09 10:24:40', '1449', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','198-3,','1','1','0','0','185','555','0','','0','0.00','0','0','0','0'); -- id=1032
UPDATE sellbilldetail SET  lastbuyprice = 185.00 , meanbuyprice = 185.00, lastbuyprice_withDiscount = 166.50, meanbuyprice_withDiscount = 166.50
        , lastbuyprice_withTax = 185, meanbuyprice_withTax = 185, lastbuyprice_withDiscountAndTax = 166.5
                where sellbilldetailid = 1032;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1449, '2026-10-09', 555, 555, 555
                    , 555, 499.5, 499.5, 499.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 555, 555, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+555, sellCostBuyPrice =sellCostBuyPrice+555
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+555, sellCostMeanBuyPrice = sellCostMeanBuyPrice+555
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+499.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+499.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+499.5
                            , 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+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 555, 555, 555
                    , 555, 499.5, 499.5, 499.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 555, 555, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+555, sellCostBuyPrice =sellCostBuyPrice+555
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+555, sellCostMeanBuyPrice = sellCostMeanBuyPrice+555
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+499.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+499.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+499.5
                            , 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 = '108', userid = '3', storedetaildate = '2026-10-09 10:24:40' WHERE storedetailid = '1466';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1449', '1', '3', '1', '274', 'اضافة فاتورة مبيعات', 'sellbillController.php', '111', '108', '3', '2026-10-09 10:24:40','0','0'); -- id=3864
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1584535',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1582375','2160', '0', '2', 'اضافة فاتورة مبيعات', '274', '1584535', '2026-10-09 10:24:40', '3',  'sellbillController.php','1','','0'); -- id=319
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2160', '2160', '2026-10-09', '3', '0', '0', '2026-10-09 10:24:40','اضافة فاتورة مبيعات رقم 274','1','0',null,'0','274','sellbillController.php?do=showDetail&sellbillid=274'); -- id=1669
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1669', '419', '2160', '','0'); -- id=1695
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1584535', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1669', '143', '2160', '','0'); -- id=1669
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '2999420', 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 ( '2029.5', '2029.5', '2026-10-09', '3', '0', '0', '2026-10-09 10:24:40','اضافة فاتورة مبيعات رقم 274 - صرف البضاعة من المخزن','1','0',null,'0','274','sellbillController.php?do=showDetail&sellbillid=274'); -- id=1670
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1670', '402', '2029.5', '','0'); -- id=1696
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2825931.49', 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 ('1670', '382', '2029.5', '','0'); -- id=1670
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19909666.71', 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='1669,0,1670' where sellbillid=274;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 2160, 2085, 2085
                    , 2085, 2029.5, 2029.5, 2029.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2085, 2085, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2160, sellCostBuyPrice =sellCostBuyPrice+2085
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2085, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2085
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2029.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2029.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2029.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2085
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2085
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2160, 2085, 2085
                    , 2085, 2029.5, 2029.5, 2029.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2085, 2085, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2160, sellCostBuyPrice =sellCostBuyPrice+2085
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2085, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2085
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2029.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2029.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2029.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2085
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2085
                        , returnSellVal = returnSellVal+0, 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, 2160, 2085, 2085
                    , 2085, 2029.5, 2029.5, 2029.5, 2085, 2085)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2160, netSellCostBuyPrice = netSellCostBuyPrice+2085
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2085
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2085
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2029.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2029.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2029.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2085
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2085;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac894ec2a559 and sellbillId = 274 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:54:41";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:24:41", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:24:41', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5597
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:54:43";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:24:43", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:24:43', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=274'); -- id=5598
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:55:13";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:25:13", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:25:13', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5599
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 06:55:13";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:25:13", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:25:13', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5600
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:02:15";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:32:15", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:32:15', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5601

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8957f54a40
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 10:32:15', '06ac8957f54a40', '1', '0.00', '0', '0', '1', '7480.00', '7480', '7480', '0', '2', '2026-10-09 10:32:15', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '18' ,'0','','','','','-1','0','0','0','0','0','7480','0','','0','0','7480','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=275
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','275', '0', '2026-10-09 10:32:15', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '7480', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:32:15','0','0','',''); -- id=382
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 135;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('380','01326', '275', '87', '1326', '6', '420', '2520', '0', '', '0', '2026-10-09 10:32:15', '1326', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','135-6,','1','1','0','0','420','2520','0','','0','0.00','0','0','0','0'); -- id=1033
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 1033;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1326, '2026-10-09', 2520, 2280, 2280
                    , 2280, 2280, 2280, 2280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2280, 2280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 2520, 2280, 2280
                    , 2280, 2280, 2280, 2280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2280, 2280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '165', userid = '4', storedetaildate = '2026-10-09 10:32:15' WHERE storedetailid = '1407';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1326', '2', '6', '1', '275', 'اضافة فاتورة مبيعات', 'sellbillController.php', '171', '165', '4', '2026-10-09 10:32:15','0','0'); -- id=3865
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 497;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('370','01362', '275', '89', '1362', '8', '410', '3280', '0', '', '0', '2026-10-09 10:32:15', '1362', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','497-8,','1','1','0','0','410','3280','0','','0','0.00','0','0','0','0'); -- id=1034
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 370.00, meanbuyprice_withDiscount = 370.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 370
                where sellbilldetailid = 1034;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1362, '2026-10-09', 3280, 2960, 2960
                    , 2960, 2960, 2960, 2960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2960, 2960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3280, sellCostBuyPrice =sellCostBuyPrice+2960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 3280, 2960, 2960
                    , 2960, 2960, 2960, 2960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2960, 2960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3280, sellCostBuyPrice =sellCostBuyPrice+2960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '4', storedetaildate = '2026-10-09 10:32:15' WHERE storedetailid = '1409';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1362', '2', '8', '1', '275', 'اضافة فاتورة مبيعات', 'sellbillController.php', '32', '24', '4', '2026-10-09 10:32:15','0','0'); -- id=3866
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 147;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('400','01356', '275', '88', '1356', '4', '420', '1680', '0', '', '0', '2026-10-09 10:32:15', '1356', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','147-4,','1','1','0','0','420','1680','0','','0','0.00','0','0','0','0'); -- id=1035
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 400.00, meanbuyprice_withDiscount = 400.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 400
                where sellbilldetailid = 1035;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1356, '2026-10-09', 1680, 1600, 1600
                    , 1600, 1600, 1600, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1600, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1680, sellCostBuyPrice =sellCostBuyPrice+1600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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 (2, '2026-10-09', 1680, 1600, 1600
                    , 1600, 1600, 1600, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1600, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1680, sellCostBuyPrice =sellCostBuyPrice+1600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '45', userid = '4', storedetaildate = '2026-10-09 10:32:15' WHERE storedetailid = '1413';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1356', '2', '4', '1', '275', 'اضافة فاتورة مبيعات', 'sellbillController.php', '49', '45', '4', '2026-10-09 10:32:15','0','0'); -- id=3867
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '387050',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('379570','7480', '0', '3', 'اضافة فاتورة مبيعات', '275', '387050', '2026-10-09 10:32:15', '4',  'sellbillController.php','1','','0'); -- id=320
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7480', '7480', '2026-10-09', '4', '0', '0', '2026-10-09 10:32:15','اضافة فاتورة مبيعات رقم 275','1','0',null,'0','275','sellbillController.php?do=showDetail&sellbillid=275'); -- id=1671
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1671', '501', '7480', '','0'); -- id=1697
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '387050', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1671', '143', '7480', '','0'); -- id=1671
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3006900', 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 ( '6840', '6840', '2026-10-09', '4', '0', '0', '2026-10-09 10:32:15','اضافة فاتورة مبيعات رقم 275 - صرف البضاعة من المخزن','1','0',null,'0','275','sellbillController.php?do=showDetail&sellbillid=275'); -- id=1672
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1672', '402', '6840', '','0'); -- id=1698
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2832771.49', 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 ('1672', '492', '6840', '','0'); -- id=1672
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '780385', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1671,0,1672' where sellbillid=275;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 7480, 6840, 6840
                    , 6840, 6840, 6840, 6840
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6840, 6840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7480, sellCostBuyPrice =sellCostBuyPrice+6840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 7480, 6840, 6840
                    , 6840, 6840, 6840, 6840
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6840, 6840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7480, sellCostBuyPrice =sellCostBuyPrice+6840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6840
                        , returnSellVal = returnSellVal+0, 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, 7480, 6840, 6840
                    , 6840, 6840, 6840, 6840, 6840, 6840)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+7480, netSellCostBuyPrice = netSellCostBuyPrice+6840
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+6840
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+6840
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+6840
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+6840
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+6840
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+6840
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+6840;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8957f54a40 and sellbillId = 275 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:02:16";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:32:16", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:32:16', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5602
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:02:30";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:32:30", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 10:32:30', '6', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5603
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:02:30";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:32:30", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 10:32:30', '6', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5604
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:02:30";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:02:33";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:32:33", deviceType = "DESKTOP" WHERE userid = 6;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:02:34";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:32:34', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3');UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:32:34", deviceType = "DESKTOP" WHERE userid = 1;
 -- id=5605
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 10:32:34', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5606
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:02:34";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 10:32:34', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5607
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:02:39";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:32:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 10:32:39', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=5608
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:02:53";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:32:53", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 10:32:53', '4', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5609
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:02:57";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:32:57", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:32:57', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5610
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:05:14";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:35:14", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:35:14', '6', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5611

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac88cdbc77a8
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 10:35:14', '06ac88cdbc77a8', '1', '0.00', '0', '0', '1', '6600.00', '6600', '6600', '0', '1', '2026-10-09 10:35:14', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '8' ,'0','','','','','-1','0','0','0','0','0','6600','0','','0','0','6600','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=276
UPDATE client SET  clientdebt = '0', userid = '6' 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','اضافة فاتورة مبيعات','276', '0', '2026-10-09 10:35:14', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '6600', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:35:14','0','0','',''); -- id=383
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 648;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('900','01735', '276', '133', '1735', '4', '900', '3600', '0', '', '0', '2026-10-09 10:35:14', '1735', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','648-4,','1','1','0','0','900','3600','0','','0','0.00','0','0','0','0'); -- id=1036
UPDATE sellbilldetail SET  lastbuyprice = 900.00 , meanbuyprice = 900.00, lastbuyprice_withDiscount = 900.00, meanbuyprice_withDiscount = 900.00
        , lastbuyprice_withTax = 900, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 900
                where sellbilldetailid = 1036;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1735, '2026-10-09', 3600, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 3600, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3600, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3600, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '6', storedetaildate = '2026-10-09 10:35:14' WHERE storedetailid = '2748';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1735', '1', '4', '1', '276', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '20', '6', '2026-10-09 10:35:14','0','0'); -- id=3868
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 647;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('750','01734', '276', '133', '1734', '4', '750', '3000', '0', '', '0', '2026-10-09 10:35:14', '1734', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','647-4,','1','1','0','0','750','3000','0','','0','0.00','0','0','0','0'); -- id=1037
UPDATE sellbilldetail SET  lastbuyprice = 750.00 , meanbuyprice = 750.00, lastbuyprice_withDiscount = 750.00, meanbuyprice_withDiscount = 750.00
        , lastbuyprice_withTax = 750, meanbuyprice_withTax = 750, lastbuyprice_withDiscountAndTax = 750
                where sellbilldetailid = 1037;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1734, '2026-10-09', 3000, 3000, 3000
                    , 3000, 3000, 3000, 3000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 3000, 3000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+3000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3000, 3000, 3000
                    , 3000, 3000, 3000, 3000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3000, 3000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+3000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '96', userid = '6', storedetaildate = '2026-10-09 10:35:14' WHERE storedetailid = '2747';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1734', '1', '4', '1', '276', 'اضافة فاتورة مبيعات', 'sellbillController.php', '100', '96', '6', '2026-10-09 10:35:14','0','0'); -- id=3869
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '44900',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('38300','6600', '0', '4', 'اضافة فاتورة مبيعات', '276', '44900', '2026-10-09 10:35:14', '6',  'sellbillController.php','1','','0'); -- id=321
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6600', '6600', '2026-10-09', '6', '0', '0', '2026-10-09 10:35:14','اضافة فاتورة مبيعات رقم 276','1','0',null,'0','276','sellbillController.php?do=showDetail&sellbillid=276'); -- id=1673
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1673', '568', '6600', '','0'); -- id=1699
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '44900', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1673', '143', '6600', '','0'); -- id=1673
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3013500', 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 ( '6600', '6600', '2026-10-09', '6', '0', '0', '2026-10-09 10:35:14','اضافة فاتورة مبيعات رقم 276 - صرف البضاعة من المخزن','1','0',null,'0','276','sellbillController.php?do=showDetail&sellbillid=276'); -- id=1674
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1674', '402', '6600', '','0'); -- id=1700
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2839371.49', 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 ('1674', '382', '6600', '','0'); -- id=1674
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19903066.71', 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='1673,0,1674' where sellbillid=276;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 6600, 6600, 6600
                    , 6600, 6600, 6600, 6600
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6600, 4800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6600, sellCostBuyPrice =sellCostBuyPrice+6600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 6600, 6600, 6600
                    , 6600, 6600, 6600, 6600
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6600, 4800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6600, sellCostBuyPrice =sellCostBuyPrice+6600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4800
                        , returnSellVal = returnSellVal+0, 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, 6600, 6600, 6600
                    , 6600, 6600, 6600, 6600, 6600, 4800)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6600, netSellCostBuyPrice = netSellCostBuyPrice+6600
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+6600
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+6600
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+6600
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+6600
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+6600
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+6600
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+4800;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac88cdbc77a8 and sellbillId = 276 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:05:14";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:35:14", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:35:14', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5612
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:06:47";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:36:47", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:36:47', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5613

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac896d9e7b42
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac896d9e7b42 and sellbillId = 277 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:06:48";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:36:48", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:36:48', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5614
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:06:56";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:36:56", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:36:56', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=277'); -- id=5615
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:07:14";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:37:14", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:37:14', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5616
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:07:45";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:37:45", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:37:45', '6', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5617

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac89892bc255
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 10:37:45', '06ac89892bc255', '1', '0.00', '0', '0', '1', '7980.00', '7980', '7980', '0', '1', '2026-10-09 10:37:45', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '15' ,'0','','','','','-1','0','0','0','0','0','7980','0','','0','0','7980','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=278
UPDATE client SET  clientdebt = '0', userid = '6' 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','اضافة فاتورة مبيعات','278', '0', '2026-10-09 10:37:45', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '7980', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:37:45','0','0','',''); -- id=385
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 55;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('440','01370', '278', '91', '1370', '12', '500', '6000', '0', '', '0', '2026-10-09 10:37:45', '1370', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','55-12,','1','1','0','0','500','6000','0','','0','0.00','0','0','0','0'); -- id=1039
UPDATE sellbilldetail SET  lastbuyprice = 440.00 , meanbuyprice = 440.00, lastbuyprice_withDiscount = 440.00, meanbuyprice_withDiscount = 440.00
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 440
                where sellbilldetailid = 1039;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1370, '2026-10-09', 6000, 5280, 5280
                    , 5280, 5280, 5280, 5280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 5280, 5280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+5280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 6000, 5280, 5280
                    , 5280, 5280, 5280, 5280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5280, 5280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+5280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '87', userid = '6', storedetaildate = '2026-10-09 10:37:45' WHERE storedetailid = '1370';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1370', '1', '12', '1', '278', 'اضافة فاتورة مبيعات', 'sellbillController.php', '99', '87', '6', '2026-10-09 10:37:45','0','0'); -- id=3871
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 291;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('630','01513', '278', '109', '1513', '3', '660', '1980', '0', '', '0', '2026-10-09 10:37:45', '1513', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','291-3,','1','1','0','0','660','1980','0','','0','0.00','0','0','0','0'); -- id=1040
UPDATE sellbilldetail SET  lastbuyprice = 630.00 , meanbuyprice = 630.00, lastbuyprice_withDiscount = 630.00, meanbuyprice_withDiscount = 630.00
        , lastbuyprice_withTax = 630, meanbuyprice_withTax = 630, lastbuyprice_withDiscountAndTax = 630
                where sellbilldetailid = 1040;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1513, '2026-10-09', 1980, 1890, 1890
                    , 1890, 1890, 1890, 1890
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1890, 1890, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1890
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1890, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1890
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1890, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1890
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1890
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1890
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1890
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1980, 1890, 1890
                    , 1890, 1890, 1890, 1890
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1890, 1890, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1890
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1890, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1890
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1890, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1890
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1890
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1890
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1890
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '33', userid = '6', storedetaildate = '2026-10-09 10:37:45' WHERE storedetailid = '1538';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1513', '1', '3', '1', '278', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '33', '6', '2026-10-09 10:37:45','0','0'); -- id=3872
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '52880',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('44900','7980', '0', '4', 'اضافة فاتورة مبيعات', '278', '52880', '2026-10-09 10:37:45', '6',  'sellbillController.php','1','','0'); -- id=323
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7980', '7980', '2026-10-09', '6', '0', '0', '2026-10-09 10:37:45','اضافة فاتورة مبيعات رقم 278','1','0',null,'0','278','sellbillController.php?do=showDetail&sellbillid=278'); -- id=1677
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1677', '568', '7980', '','0'); -- id=1703
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '52880', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1677', '143', '7980', '','0'); -- id=1677
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3023105', 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 ( '7170', '7170', '2026-10-09', '6', '0', '0', '2026-10-09 10:37:45','اضافة فاتورة مبيعات رقم 278 - صرف البضاعة من المخزن','1','0',null,'0','278','sellbillController.php?do=showDetail&sellbillid=278'); -- id=1678
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1678', '402', '7170', '','0'); -- id=1704
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2848066.49', 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 ('1678', '382', '7170', '','0'); -- id=1678
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19894371.71', 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='1677,0,1678' where sellbillid=278;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 7980, 7170, 7170
                    , 7170, 7170, 7170, 7170
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7170, 7170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7980, sellCostBuyPrice =sellCostBuyPrice+7170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7170, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7170
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7170
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7170
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 7980, 7170, 7170
                    , 7170, 7170, 7170, 7170
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7170, 7170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7980, sellCostBuyPrice =sellCostBuyPrice+7170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7170, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7170
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7170
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7170
                        , returnSellVal = returnSellVal+0, 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, 7980, 7170, 7170
                    , 7170, 7170, 7170, 7170, 7170, 7170)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+7980, netSellCostBuyPrice = netSellCostBuyPrice+7170
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+7170
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+7170
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+7170
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+7170
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+7170
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+7170
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+7170;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac89892bc255 and sellbillId = 278 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:07:45";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:37:45", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:37:45', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5618
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:08:15";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:38:15", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:38:15', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5619

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8964c20396
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 10:38:15', '06ac8964c20396', '1', '0.00', '0', '140', '1', '31840.00', '31700', '31700', '0', '1', '2026-10-09 10:38:15', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '72' ,'0','','','','','-1','0','0','0','0','0','31700','0','','0','0','31700','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=279
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','279', '0', '2026-10-09 10:38:15', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '31700', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:38:15','0','0','',''); -- id=386
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 246;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('500','01483', '279', '107', '1483', '8', '540', '4320', '0', '', '0', '2026-10-09 10:38:15', '1483', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','246-8,','1','1','0','0','540','4320','0','','0','0.00','0','0','0','0'); -- id=1041
UPDATE sellbilldetail SET  lastbuyprice = 500.00 , meanbuyprice = 500.00, lastbuyprice_withDiscount = 500.00, meanbuyprice_withDiscount = 500.00
        , lastbuyprice_withTax = 500, meanbuyprice_withTax = 500, lastbuyprice_withDiscountAndTax = 500
                where sellbilldetailid = 1041;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1483, '2026-10-09', 4301.0050251256, 4000, 4000
                    , 4000, 4000, 4000, 4000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 4000, 4000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4301.0050251256, sellCostBuyPrice =sellCostBuyPrice+4000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4301.0050251256, 4000, 4000
                    , 4000, 4000, 4000, 4000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4000, 4000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4301.0050251256, sellCostBuyPrice =sellCostBuyPrice+4000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 10:38:15' WHERE storedetailid = '1508';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1483', '1', '8', '1', '279', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8', '0', '2', '2026-10-09 10:38:15','0','0'); -- id=3873
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 282;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('288','01472', '279', '105', '1472', '9', '320', '2880', '0', '', '0', '2026-10-09 10:38:15', '1472', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','282-9,','1','1','0','0','320','2880','0','','0','0.00','0','0','0','0'); -- id=1042
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 288.00, meanbuyprice_withDiscount = 288.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 288
                where sellbilldetailid = 1042;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1472, '2026-10-09', 2867.3366834171, 2880, 2880
                    , 2880, 2592, 2592, 2592
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2867.3366834171, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2592, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2592
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2592
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2867.3366834171, 2880, 2880
                    , 2880, 2592, 2592, 2592
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2867.3366834171, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2592, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2592
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2592
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '63', userid = '2', storedetaildate = '2026-10-09 10:38:15' WHERE storedetailid = '1497';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1472', '1', '9', '1', '279', 'اضافة فاتورة مبيعات', 'sellbillController.php', '72', '63', '2', '2026-10-09 10:38:15','0','0'); -- id=3874
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+16 where id = 355;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('276','01467', '279', '104', '1467', '16', '340', '5440', '0', '', '0', '2026-10-09 10:38:15', '1467', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','355-16,','1','1','0','0','340','5440','0','','0','0.00','0','0','0','0'); -- id=1043
UPDATE sellbilldetail SET  lastbuyprice = 276.00 , meanbuyprice = 276.00, lastbuyprice_withDiscount = 276.00, meanbuyprice_withDiscount = 276.00
        , lastbuyprice_withTax = 276, meanbuyprice_withTax = 276, lastbuyprice_withDiscountAndTax = 276
                where sellbilldetailid = 1043;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1467, '2026-10-09', 5416.0804020101, 4416, 4416
                    , 4416, 4416, 4416, 4416
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 4416, 4416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5416.0804020101, sellCostBuyPrice =sellCostBuyPrice+4416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4416, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4416
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5416.0804020101, 4416, 4416
                    , 4416, 4416, 4416, 4416
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4416, 4416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5416.0804020101, sellCostBuyPrice =sellCostBuyPrice+4416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4416, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4416
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '712', userid = '2', storedetaildate = '2026-10-09 10:38:15' WHERE storedetailid = '1492';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1467', '1', '16', '1', '279', 'اضافة فاتورة مبيعات', 'sellbillController.php', '728', '712', '2', '2026-10-09 10:38:15','0','0'); -- id=3875
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+24 where id = 581;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('510','01718', '279', '131', '1718', '24', '535', '12840', '0', '', '0', '2026-10-09 10:38:15', '1718', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','581-24,','1','1','0','0','535','12840','0','','0','0.00','0','0','0','0'); -- id=1044
UPDATE sellbilldetail SET  lastbuyprice = 510.00 , meanbuyprice = 510.00, lastbuyprice_withDiscount = 510.00, meanbuyprice_withDiscount = 510.00
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 510
                where sellbilldetailid = 1044;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1718, '2026-10-09', 12783.542713568, 12240, 12240
                    , 12240, 12240, 12240, 12240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24, 0, 12240, 12240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12783.542713568, sellCostBuyPrice =sellCostBuyPrice+12240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-10-09', 12783.542713568, 12240, 12240
                    , 12240, 12240, 12240, 12240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12240, 12240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12783.542713568, sellCostBuyPrice =sellCostBuyPrice+12240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '135', userid = '2', storedetaildate = '2026-10-09 10:38:15' WHERE storedetailid = '2730';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1718', '1', '24', '1', '279', 'اضافة فاتورة مبيعات', 'sellbillController.php', '159', '135', '2', '2026-10-09 10:38:15','0','0'); -- id=3876
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 425;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('372','01584', '279', '115', '1584', '6', '400', '2400', '0', '', '0', '2026-10-09 10:38:15', '1584', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','425-6,','1','1','0','0','400','2400','0','','0','0.00','0','0','0','0'); -- id=1045
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 372.00, meanbuyprice_withDiscount = 372.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 372
                where sellbilldetailid = 1045;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1584, '2026-10-09', 2389.4472361809, 2400, 2400
                    , 2400, 2232, 2232, 2232
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2389.4472361809, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2232, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2232
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2232
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2389.4472361809, 2400, 2400
                    , 2400, 2232, 2232, 2232
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2389.4472361809, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2232, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2232
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2232
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 10:38:15' WHERE storedetailid = '1609';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1584', '1', '6', '1', '279', 'اضافة فاتورة مبيعات', 'sellbillController.php', '66', '60', '2', '2026-10-09 10:38:15','0','0'); -- id=3877
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 556;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('404.8','01692', '279', '126', '1692', '9', '440', '3960', '0', '', '0', '2026-10-09 10:38:15', '1692', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','556-9,','1','1','0','0','440','3960','0','','0','0.00','0','0','0','0'); -- id=1046
UPDATE sellbilldetail SET  lastbuyprice = 440.00 , meanbuyprice = 440.00, lastbuyprice_withDiscount = 404.80, meanbuyprice_withDiscount = 404.80
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 404.8
                where sellbilldetailid = 1046;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1692, '2026-10-09', 3942.5879396985, 3960, 3960
                    , 3960, 3643.2, 3643.2, 3643.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3960, 3960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3942.5879396985, sellCostBuyPrice =sellCostBuyPrice+3960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3643.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3643.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3643.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3942.5879396985, 3960, 3960
                    , 3960, 3643.2, 3643.2, 3643.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3960, 3960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3942.5879396985, sellCostBuyPrice =sellCostBuyPrice+3960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3643.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3643.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3643.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 10:38:15' WHERE storedetailid = '2704';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1692', '1', '9', '1', '279', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '3', '2', '2026-10-09 10:38:15','0','0'); -- id=3878
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1617860',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1586160','31700', '0', '2', 'اضافة فاتورة مبيعات', '279', '1617860', '2026-10-09 10:38:15', '2',  'sellbillController.php','1','','0'); -- id=324
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '31840', '31840', '2026-10-09', '2', '0', '0', '2026-10-09 10:38:15','اضافة فاتورة مبيعات رقم 279','1','0',null,'0','279','sellbillController.php?do=showDetail&sellbillid=279'); -- id=1679
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1679', '419', '31700', '','0'); -- id=1705
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1617860', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1679', '398', '140', '','0'); -- id=1706
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '137408', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1679', '143', '31840', '','0'); -- id=1679
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3054945', 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 ( '29123.2', '29123.2', '2026-10-09', '2', '0', '0', '2026-10-09 10:38:15','اضافة فاتورة مبيعات رقم 279 - صرف البضاعة من المخزن','1','0',null,'0','279','sellbillController.php?do=showDetail&sellbillid=279'); -- id=1680
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1680', '402', '29123.2', '','0'); -- id=1707
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2877189.69', 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 ('1680', '382', '29123.2', '','0'); -- id=1680
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19865248.51', 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='1679,0,1680' where sellbillid=279;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 31700, 29896, 29896
                    , 29896, 29123.2, 29123.2, 29123.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,29896, 29896, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+31700, sellCostBuyPrice =sellCostBuyPrice+29896
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+29896, sellCostMeanBuyPrice = sellCostMeanBuyPrice+29896
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+29123.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+29123.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+29123.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+29896
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+29896
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 31700, 29896, 29896
                    , 29896, 29123.2, 29123.2, 29123.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,29896, 29896, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+31700, sellCostBuyPrice =sellCostBuyPrice+29896
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+29896, sellCostMeanBuyPrice = sellCostMeanBuyPrice+29896
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+29123.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+29123.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+29123.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+29896
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+29896
                        , returnSellVal = returnSellVal+0, 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, 31700, 29896, 29896
                    , 29896, 29123.2, 29123.2, 29123.2, 29896, 29896)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+31700, netSellCostBuyPrice = netSellCostBuyPrice+29896
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+29896
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+29896
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+29123.2
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+29123.2
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+29123.2
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+29896
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+29896;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8964c20396 and sellbillId = 279 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:08:16";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:38:16", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:38:16', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5620
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:14:18";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:44:18", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:44:18', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5621

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac898a9ab22a
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 10:44:18', '06ac898a9ab22a', '1', '0.00', '0', '0', '1', '9960.00', '9960', '9960', '0', '2', '2026-10-09 10:44:18', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '24' ,'0','','','','','-1','0','0','0','0','0','9960','0','','0','0','9960','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=280
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','280', '0', '2026-10-09 10:44:18', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '9960', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:44:18','0','0','',''); -- id=387
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 497;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('370','01362', '280', '89', '1362', '12', '410', '4920', '0', '', '0', '2026-10-09 10:44:18', '1362', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','497-12,','1','1','0','0','410','4920','0','','0','0.00','0','0','0','0'); -- id=1047
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 370.00, meanbuyprice_withDiscount = 370.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 370
                where sellbilldetailid = 1047;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1362, '2026-10-09', 4920, 4440, 4440
                    , 4440, 4440, 4440, 4440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4440, 4440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4920, sellCostBuyPrice =sellCostBuyPrice+4440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-09', 4920, 4440, 4440
                    , 4440, 4440, 4440, 4440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4440, 4440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4920, sellCostBuyPrice =sellCostBuyPrice+4440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '4', storedetaildate = '2026-10-09 10:44:18' WHERE storedetailid = '1409';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1362', '2', '12', '1', '280', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '12', '4', '2026-10-09 10:44:18','0','0'); -- id=3879
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 221;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('390','01440', '280', '88', '1440', '12', '420', '5040', '0', '', '0', '2026-10-09 10:44:18', '1440', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','221-12,','1','1','0','0','420','5040','0','','0','0.00','0','0','0','0'); -- id=1048
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 390.00
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 390
                where sellbilldetailid = 1048;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1440, '2026-10-09', 5040, 4680, 4680
                    , 4680, 4680, 4680, 4680
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4680, 4680, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5040, sellCostBuyPrice =sellCostBuyPrice+4680
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4680, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4680
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4680, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4680
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4680
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4680
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4680
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-09', 5040, 4680, 4680
                    , 4680, 4680, 4680, 4680
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4680, 4680, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5040, sellCostBuyPrice =sellCostBuyPrice+4680
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4680, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4680
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4680, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4680
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4680
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4680
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4680
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '44', userid = '4', storedetaildate = '2026-10-09 10:44:18' WHERE storedetailid = '1471';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1440', '2', '12', '1', '280', 'اضافة فاتورة مبيعات', 'sellbillController.php', '56', '44', '4', '2026-10-09 10:44:18','0','0'); -- id=3880
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '397010',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('387050','9960', '0', '3', 'اضافة فاتورة مبيعات', '280', '397010', '2026-10-09 10:44:18', '4',  'sellbillController.php','1','','0'); -- id=325
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '9960', '9960', '2026-10-09', '4', '0', '0', '2026-10-09 10:44:18','اضافة فاتورة مبيعات رقم 280','1','0',null,'0','280','sellbillController.php?do=showDetail&sellbillid=280'); -- id=1681
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1681', '501', '9960', '','0'); -- id=1708
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '397010', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1681', '143', '9960', '','0'); -- id=1681
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3064905', 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 ( '9120', '9120', '2026-10-09', '4', '0', '0', '2026-10-09 10:44:18','اضافة فاتورة مبيعات رقم 280 - صرف البضاعة من المخزن','1','0',null,'0','280','sellbillController.php?do=showDetail&sellbillid=280'); -- id=1682
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1682', '402', '9120', '','0'); -- id=1709
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2886309.69', 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 ('1682', '492', '9120', '','0'); -- id=1682
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '771265', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1681,0,1682' where sellbillid=280;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 9960, 9120, 9120
                    , 9120, 9120, 9120, 9120
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9120, 9120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9960, sellCostBuyPrice =sellCostBuyPrice+9120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 9960, 9120, 9120
                    , 9120, 9120, 9120, 9120
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9120, 9120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9960, sellCostBuyPrice =sellCostBuyPrice+9120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9120
                        , returnSellVal = returnSellVal+0, 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, 9960, 9120, 9120
                    , 9120, 9120, 9120, 9120, 9120, 9120)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+9960, netSellCostBuyPrice = netSellCostBuyPrice+9120
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+9120
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+9120
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+9120
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+9120
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+9120
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+9120
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+9120;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac898a9ab22a and sellbillId = 280 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:14:18";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:44:18", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:44:18', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5622
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:14:23";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:44:23", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:44:23', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5623

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac899e836c3e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 10:44:23', '06ac899e836c3e', '1', '0.00', '0', '5', '1', '3150.00', '3145', '3145', '0', '1', '2026-10-09 10:44:23', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '9' ,'0','','','','','-1','0','0','0','0','0','3145','0','','0','0','3145','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=281
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','281', '0', '2026-10-09 10:44:23', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3145', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:44:23','0','0','',''); -- id=388
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 558;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('322','01694', '281', '127', '1694', '9', '350', '3150', '0', '', '0', '2026-10-09 10:44:23', '1694', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','558-9,','1','1','0','0','350','3150','0','','0','0.00','0','0','0','0'); -- id=1049
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 322.00, meanbuyprice_withDiscount = 322.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 322
                where sellbilldetailid = 1049;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1694, '2026-10-09', 3145, 3150, 3150
                    , 3150, 2898, 2898, 2898
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3145, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2898, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2898
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2898
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3145, 3150, 3150
                    , 3150, 2898, 2898, 2898
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3145, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2898, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2898
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2898
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '2', storedetaildate = '2026-10-09 10:44:23' WHERE storedetailid = '2706';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1694', '1', '9', '1', '281', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '21', '2', '2026-10-09 10:44:23','0','0'); -- id=3881
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1621005',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1617860','3145', '0', '2', 'اضافة فاتورة مبيعات', '281', '1621005', '2026-10-09 10:44:23', '2',  'sellbillController.php','1','','0'); -- id=326
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3150', '3150', '2026-10-09', '2', '0', '0', '2026-10-09 10:44:23','اضافة فاتورة مبيعات رقم 281','1','0',null,'0','281','sellbillController.php?do=showDetail&sellbillid=281'); -- id=1683
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1683', '419', '3145', '','0'); -- id=1710
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1621005', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1683', '398', '5', '','0'); -- id=1711
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '137413', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1683', '143', '3150', '','0'); -- id=1683
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3068055', 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 ( '2898', '2898', '2026-10-09', '2', '0', '0', '2026-10-09 10:44:23','اضافة فاتورة مبيعات رقم 281 - صرف البضاعة من المخزن','1','0',null,'0','281','sellbillController.php?do=showDetail&sellbillid=281'); -- id=1684
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1684', '402', '2898', '','0'); -- id=1712
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2889207.69', 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 ('1684', '382', '2898', '','0'); -- id=1684
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19862350.51', 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='1683,0,1684' where sellbillid=281;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 3145, 3150, 3150
                    , 3150, 2898, 2898, 2898
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3145, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2898, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2898
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2898
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3145, 3150, 3150
                    , 3150, 2898, 2898, 2898
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3145, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2898, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2898
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2898
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, 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, 3145, 3150, 3150
                    , 3150, 2898, 2898, 2898, 3150, 3150)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3145, netSellCostBuyPrice = netSellCostBuyPrice+3150
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3150
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3150
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2898
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2898
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2898
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3150
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3150;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac899e836c3e and sellbillId = 281 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:14:23";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:44:23", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:44:23', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5624
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:14:25";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:44:25", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:44:25', '6', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5625

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac89932eb647
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac89932eb647 and sellbillId = 282 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:14:25";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:44:25", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:44:25', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5626
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:14:36";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:44:36", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:44:36', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5627

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac899aac3fc7
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 10:44:37', '06ac899aac3fc7', '1', '0.00', '0', '0', '1', '6025.00', '6025', '6025', '0', '1', '2026-10-09 10:44:37', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '22' ,'0','','','','','-1','0','0','0','0','0','6025','0','','0','0','6025','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=283
UPDATE client SET  clientdebt = '0', userid = '3' 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','اضافة فاتورة مبيعات','283', '0', '2026-10-09 10:44:37', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '6025', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:44:37','0','0','',''); -- id=390
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 428;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('292.95','01587', '283', '115', '1587', '6', '315', '1890', '0', '', '0', '2026-10-09 10:44:37', '1587', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','428-6,','1','1','0','0','315','1890','0','','0','0.00','0','0','0','0'); -- id=1051
UPDATE sellbilldetail SET  lastbuyprice = 315.00 , meanbuyprice = 315.00, lastbuyprice_withDiscount = 292.95, meanbuyprice_withDiscount = 292.95
        , lastbuyprice_withTax = 315, meanbuyprice_withTax = 315, lastbuyprice_withDiscountAndTax = 292.95
                where sellbilldetailid = 1051;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1587, '2026-10-09', 1890, 1890, 1890
                    , 1890, 1757.7, 1757.7, 1757.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1890, 1890, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1890, sellCostBuyPrice =sellCostBuyPrice+1890
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1890, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1890
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1757.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1757.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1757.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1890
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1890
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1890, 1890, 1890
                    , 1890, 1757.7, 1757.7, 1757.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1890, 1890, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1890, sellCostBuyPrice =sellCostBuyPrice+1890
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1890, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1890
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1757.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1757.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1757.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1890
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1890
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '3', storedetaildate = '2026-10-09 10:44:37' WHERE storedetailid = '1612';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1587', '1', '6', '1', '283', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '12', '3', '2026-10-09 10:44:37','0','0'); -- id=3883
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 201;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('216','01452', '283', '101', '1452', '3', '240', '720', '0', '', '0', '2026-10-09 10:44:37', '1452', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','201-3,','1','1','0','0','240','720','0','','0','0.00','0','0','0','0'); -- id=1052
UPDATE sellbilldetail SET  lastbuyprice = 240.00 , meanbuyprice = 240.00, lastbuyprice_withDiscount = 216.00, meanbuyprice_withDiscount = 216.00
        , lastbuyprice_withTax = 240, meanbuyprice_withTax = 240, lastbuyprice_withDiscountAndTax = 216
                where sellbilldetailid = 1052;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1452, '2026-10-09', 720, 720, 720
                    , 720, 648, 648, 648
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 720, 720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+648, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+648
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+648
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 720, 720, 720
                    , 720, 648, 648, 648
                    , 0, 0, 0, 0
                    , 0, 0, 0, 720, 720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+648, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+648
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+648
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '3', storedetaildate = '2026-10-09 10:44:37' WHERE storedetailid = '1469';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1452', '1', '3', '1', '283', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '27', '3', '2026-10-09 10:44:37','0','0'); -- id=3884
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 427;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('302.25','01586', '283', '115', '1586', '3', '325', '975', '0', '', '0', '2026-10-09 10:44:37', '1586', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','427-3,','1','1','0','0','325','975','0','','0','0.00','0','0','0','0'); -- id=1053
UPDATE sellbilldetail SET  lastbuyprice = 325.00 , meanbuyprice = 325.00, lastbuyprice_withDiscount = 302.25, meanbuyprice_withDiscount = 302.25
        , lastbuyprice_withTax = 325, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 302.25
                where sellbilldetailid = 1053;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1586, '2026-10-09', 975, 975, 975
                    , 975, 906.75, 906.75, 906.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 975, 975, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+975, sellCostBuyPrice =sellCostBuyPrice+975
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+975, sellCostMeanBuyPrice = sellCostMeanBuyPrice+975
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+906.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+906.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+906.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+975
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+975
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 975, 975, 975
                    , 975, 906.75, 906.75, 906.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 975, 975, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+975, sellCostBuyPrice =sellCostBuyPrice+975
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+975, sellCostMeanBuyPrice = sellCostMeanBuyPrice+975
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+906.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+906.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+906.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+975
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+975
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '33', userid = '3', storedetaildate = '2026-10-09 10:44:37' WHERE storedetailid = '1611';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1586', '1', '3', '1', '283', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '33', '3', '2026-10-09 10:44:37','0','0'); -- id=3885
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 354;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','01466', '283', '104', '1466', '4', '370', '1480', '0', '', '0', '2026-10-09 10:44:37', '1466', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','354-4,','1','1','0','0','370','1480','0','','0','0.00','0','0','0','0'); -- id=1054
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 1054;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1466, '2026-10-09', 1480, 1200, 1200
                    , 1200, 1200, 1200, 1200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1480, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1480, 1200, 1200
                    , 1200, 1200, 1200, 1200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1480, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '468', userid = '3', storedetaildate = '2026-10-09 10:44:37' WHERE storedetailid = '1491';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1466', '1', '4', '1', '283', 'اضافة فاتورة مبيعات', 'sellbillController.php', '472', '468', '3', '2026-10-09 10:44:37','0','0'); -- id=3886
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 197;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('144','01448', '283', '101', '1448', '6', '160', '960', '0', '', '0', '2026-10-09 10:44:37', '1448', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','197-6,','1','1','0','0','160','960','0','','0','0.00','0','0','0','0'); -- id=1055
UPDATE sellbilldetail SET  lastbuyprice = 160.00 , meanbuyprice = 160.00, lastbuyprice_withDiscount = 144.00, meanbuyprice_withDiscount = 144.00
        , lastbuyprice_withTax = 160, meanbuyprice_withTax = 160, lastbuyprice_withDiscountAndTax = 144
                where sellbilldetailid = 1055;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1448, '2026-10-09', 960, 960, 960
                    , 960, 864, 864, 864
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+864, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+864
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+864
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 960, 960, 960
                    , 960, 864, 864, 864
                    , 0, 0, 0, 0
                    , 0, 0, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+864, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+864
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+864
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 10:44:37' WHERE storedetailid = '1465';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1448', '1', '6', '1', '283', 'اضافة فاتورة مبيعات', 'sellbillController.php', '45', '39', '3', '2026-10-09 10:44:37','0','0'); -- id=3887
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1627030',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1621005','6025', '0', '2', 'اضافة فاتورة مبيعات', '283', '1627030', '2026-10-09 10:44:37', '3',  'sellbillController.php','1','','0'); -- id=328
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6025', '6025', '2026-10-09', '3', '0', '0', '2026-10-09 10:44:37','اضافة فاتورة مبيعات رقم 283','1','0',null,'0','283','sellbillController.php?do=showDetail&sellbillid=283'); -- id=1687
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1687', '419', '6025', '','0'); -- id=1715
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1627030', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1687', '143', '6025', '','0'); -- id=1687
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3078040', 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 ( '5376.45', '5376.45', '2026-10-09', '3', '0', '0', '2026-10-09 10:44:37','اضافة فاتورة مبيعات رقم 283 - صرف البضاعة من المخزن','1','0',null,'0','283','sellbillController.php?do=showDetail&sellbillid=283'); -- id=1688
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1688', '402', '5376.45', '','0'); -- id=1716
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2898364.14', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1688', '382', '5376.45', '','0'); -- id=1688
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19853194.06', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1687,0,1688' where sellbillid=283;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 6025, 5745, 5745
                    , 5745, 5376.45, 5376.45, 5376.45
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5745, 5745, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6025, sellCostBuyPrice =sellCostBuyPrice+5745
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5745, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5745
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5376.45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5376.45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5376.45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5745
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5745
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 6025, 5745, 5745
                    , 5745, 5376.45, 5376.45, 5376.45
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5745, 5745, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6025, sellCostBuyPrice =sellCostBuyPrice+5745
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5745, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5745
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5376.45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5376.45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5376.45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5745
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5745
                        , returnSellVal = returnSellVal+0, 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, 6025, 5745, 5745
                    , 5745, 5376.45, 5376.45, 5376.45, 5745, 5745)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6025, netSellCostBuyPrice = netSellCostBuyPrice+5745
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5745
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5745
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5376.45
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5376.45
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5376.45
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5745
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5745;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac899aac3fc7 and sellbillId = 283 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:14:37";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:44:37", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:44:37', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5628
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:14:40";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:44:40", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:44:40', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=283'); -- id=5629
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:14:49";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:44:49", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:44:49', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5630
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:14:50";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:44:50", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:44:50', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5631
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:17:05";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:47:05", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:47:05', '6', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5632

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac89b599b032
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac89b599b032 and sellbillId = 284 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:17:05";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:47:05", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:47:05', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5633
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:17:31";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:47:31", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:47:31', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5634

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac89b57ce89d
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 10:47:31', '06ac89b57ce89d', '1', '0.00', '0', '0', '1', '9780.00', '9780', '9780', '0', '1', '2026-10-09 10:47:31', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '30' ,'0','','','','','-1','0','0','0','0','0','9780','0','','0','0','9780','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=285
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','285', '0', '2026-10-09 10:47:31', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '9780', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:47:31','0','0','',''); -- id=392
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 328;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','01458', '285', '103', '1458', '12', '320', '3840', '0', '', '0', '2026-10-09 10:47:31', '1458', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','328-12,','1','1','0','0','320','3840','0','','0','0.00','0','0','0','0'); -- id=1057
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 1057;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1458, '2026-10-09', 3840, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3840, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-09 10:47:31' WHERE storedetailid = '1483';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1458', '1', '12', '1', '285', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '24', '2', '2026-10-09 10:47:31','0','0'); -- id=3889
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','01379', '285', '94', '1379', '9', '300', '2700', '0', '', '0', '2026-10-09 10:47:31', '1379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','71-9,','1','1','0','0','300','2700','0','','0','0.00','0','0','0','0'); -- id=1058
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1058;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-09', 2700, 2430, 2430
                    , 2430, 2430, 2430, 2430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2430, 2430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2700, 2430, 2430
                    , 2430, 2430, 2430, 2430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2430, 2430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '645', userid = '2', storedetaildate = '2026-10-09 10:47:31' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '9', '1', '285', 'اضافة فاتورة مبيعات', 'sellbillController.php', '654', '645', '2', '2026-10-09 10:47:31','0','0'); -- id=3890
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 70;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01378', '285', '94', '1378', '9', '360', '3240', '0', '', '0', '2026-10-09 10:47:31', '1378', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','70-9,','1','1','0','0','360','3240','0','','0','0.00','0','0','0','0'); -- id=1059
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 1059;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1378, '2026-10-09', 3240, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3240, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3240, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3240, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '639', userid = '2', storedetaildate = '2026-10-09 10:47:31' WHERE storedetailid = '1378';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1378', '1', '9', '1', '285', 'اضافة فاتورة مبيعات', 'sellbillController.php', '648', '639', '2', '2026-10-09 10:47:31','0','0'); -- id=3891
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1636810',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1627030','9780', '0', '2', 'اضافة فاتورة مبيعات', '285', '1636810', '2026-10-09 10:47:31', '2',  'sellbillController.php','1','','0'); -- id=330
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '9780', '9780', '2026-10-09', '2', '0', '0', '2026-10-09 10:47:31','اضافة فاتورة مبيعات رقم 285','1','0',null,'0','285','sellbillController.php?do=showDetail&sellbillid=285'); -- id=1691
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1691', '419', '9780', '','0'); -- id=1719
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1636810', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1691', '143', '9780', '','0'); -- id=1691
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3090220', 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 ( '8910', '8910', '2026-10-09', '2', '0', '0', '2026-10-09 10:47:31','اضافة فاتورة مبيعات رقم 285 - صرف البضاعة من المخزن','1','0',null,'0','285','sellbillController.php?do=showDetail&sellbillid=285'); -- id=1692
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1692', '402', '8910', '','0'); -- id=1720
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2909434.14', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1692', '382', '8910', '','0'); -- id=1692
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19842124.06', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1691,0,1692' where sellbillid=285;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 9780, 8910, 8910
                    , 8910, 8910, 8910, 8910
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8910, 8910, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9780, sellCostBuyPrice =sellCostBuyPrice+8910
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8910, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8910
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8910, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8910
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8910
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8910
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8910
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 9780, 8910, 8910
                    , 8910, 8910, 8910, 8910
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8910, 8910, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9780, sellCostBuyPrice =sellCostBuyPrice+8910
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8910, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8910
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8910, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8910
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8910
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8910
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8910
                        , returnSellVal = returnSellVal+0, 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, 9780, 8910, 8910
                    , 8910, 8910, 8910, 8910, 8910, 8910)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+9780, netSellCostBuyPrice = netSellCostBuyPrice+8910
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+8910
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+8910
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+8910
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+8910
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+8910
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+8910
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+8910;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac89b57ce89d and sellbillId = 285 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:17:31";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:47:31", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:47:31', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5635
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:18:18";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:48:18", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:48:18', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5636

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac89c1397981
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 10:48:18', '06ac89c1397981', '1', '0.00', '0', '0', '1', '1360.00', '1360', '1360', '0', '1', '2026-10-09 10:48:18', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '4' ,'0','','','','','-1','0','0','0','0','0','1360','0','','0','0','1360','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=286
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','286', '0', '2026-10-09 10:48:18', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1360', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:48:18','0','0','',''); -- id=393
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 155;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('339.99','01405', '286', '99', '1405', '4', '340', '1360', '0', '', '0', '2026-10-09 10:48:18', '1405', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','155-4,','1','1','0','0','340','1360','0','','0','0.00','0','0','0','0'); -- id=1060
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 339.99, meanbuyprice_withDiscount = 339.99
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 340, lastbuyprice_withDiscountAndTax = 339.99
                where sellbilldetailid = 1060;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1405, '2026-10-09', 1360, 1360, 1360
                    , 1360, 1359.96, 1359.96, 1359.96
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1360, 1360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1360, sellCostBuyPrice =sellCostBuyPrice+1360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1359.96, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1359.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1359.96
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1360, 1360, 1360
                    , 1360, 1359.96, 1359.96, 1359.96
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1360, 1360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1360, sellCostBuyPrice =sellCostBuyPrice+1360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1359.96, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1359.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1359.96
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 10:48:18' WHERE storedetailid = '1418';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1405', '1', '4', '1', '286', 'اضافة فاتورة مبيعات', 'sellbillController.php', '252', '248', '2', '2026-10-09 10:48:18','0','0'); -- id=3892
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1638170',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1636810','1360', '0', '2', 'اضافة فاتورة مبيعات', '286', '1638170', '2026-10-09 10:48:18', '2',  'sellbillController.php','1','','0'); -- id=331
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1360', '1360', '2026-10-09', '2', '0', '0', '2026-10-09 10:48:18','اضافة فاتورة مبيعات رقم 286','1','0',null,'0','286','sellbillController.php?do=showDetail&sellbillid=286'); -- id=1693
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1693', '419', '1360', '','0'); -- id=1721
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1638170', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1693', '143', '1360', '','0'); -- id=1693
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3091580', 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 ( '1359.96', '1359.96', '2026-10-09', '2', '0', '0', '2026-10-09 10:48:18','اضافة فاتورة مبيعات رقم 286 - صرف البضاعة من المخزن','1','0',null,'0','286','sellbillController.php?do=showDetail&sellbillid=286'); -- id=1694
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1694', '402', '1359.96', '','0'); -- id=1722
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2910794.1', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1694', '382', '1359.96', '','0'); -- id=1694
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19840764.1', 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='1693,0,1694' where sellbillid=286;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 1360, 1360, 1360
                    , 1360, 1359.96, 1359.96, 1359.96
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1360, 1360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1360, sellCostBuyPrice =sellCostBuyPrice+1360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1359.96, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1359.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1359.96
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1360, 1360, 1360
                    , 1360, 1359.96, 1359.96, 1359.96
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1360, 1360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1360, sellCostBuyPrice =sellCostBuyPrice+1360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1359.96, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1359.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1359.96
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1360
                        , returnSellVal = returnSellVal+0, 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, 1360, 1360, 1360
                    , 1360, 1359.96, 1359.96, 1359.96, 1360, 1360)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1360, netSellCostBuyPrice = netSellCostBuyPrice+1360
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1360
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1360
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1359.96
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1359.96
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1359.96
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1360
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1360;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac89c1397981 and sellbillId = 286 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:18:18";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:48:18", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:48:18', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5637
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:19:15";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:49:15", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:49:15', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5638

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac89c42caeb7
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 10:49:15', '06ac89c42caeb7', '1', '0.00', '0', '0', '1', '3600.00', '3600', '3600', '0', '1', '2026-10-09 10:49:15', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '12' ,'0','','','','','-1','0','0','0','0','0','3600','0','','0','0','3600','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=287
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','287', '0', '2026-10-09 10:49:15', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3600', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:49:15','0','0','',''); -- id=394
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 234;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','01455', '287', '94', '1455', '12', '300', '3600', '0', '', '0', '2026-10-09 10:49:15', '1455', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','234-12,','1','1','0','0','300','3600','0','','0','0.00','0','0','0','0'); -- id=1061
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1061;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1455, '2026-10-09', 3600, 3240, 3240
                    , 3240, 3240, 3240, 3240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3600, 3240, 3240
                    , 3240, 3240, 3240, 3240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '63', userid = '2', storedetaildate = '2026-10-09 10:49:15' WHERE storedetailid = '1480';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1455', '1', '12', '1', '287', 'اضافة فاتورة مبيعات', 'sellbillController.php', '75', '63', '2', '2026-10-09 10:49:15','0','0'); -- id=3893
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1641770',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1638170','3600', '0', '2', 'اضافة فاتورة مبيعات', '287', '1641770', '2026-10-09 10:49:15', '2',  'sellbillController.php','1','','0'); -- id=332
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3600', '3600', '2026-10-09', '2', '0', '0', '2026-10-09 10:49:15','اضافة فاتورة مبيعات رقم 287','1','0',null,'0','287','sellbillController.php?do=showDetail&sellbillid=287'); -- id=1695
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1695', '419', '3600', '','0'); -- id=1723
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1641770', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1695', '143', '3600', '','0'); -- id=1695
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3095180', 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 ( '3240', '3240', '2026-10-09', '2', '0', '0', '2026-10-09 10:49:15','اضافة فاتورة مبيعات رقم 287 - صرف البضاعة من المخزن','1','0',null,'0','287','sellbillController.php?do=showDetail&sellbillid=287'); -- id=1696
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1696', '402', '3240', '','0'); -- id=1724
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2914034.1', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1696', '382', '3240', '','0'); -- id=1696
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19837524.1', 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='1695,0,1696' where sellbillid=287;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 3600, 3240, 3240
                    , 3240, 3240, 3240, 3240
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3600, 3240, 3240
                    , 3240, 3240, 3240, 3240
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, 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, 3600, 3240, 3240
                    , 3240, 3240, 3240, 3240, 3240, 3240)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3600, netSellCostBuyPrice = netSellCostBuyPrice+3240
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3240
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3240
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3240
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3240
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3240
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3240
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3240;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:19:15";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:49:15", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:49:15', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5639
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:19:34";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:49:34", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:49:34', '2', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=287'); -- id=5640
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:19:39";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:49:39", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:49:39', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5641
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:21:03";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:51:03", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:51:03', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5642

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac89b7281764
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 10:51:03', '06ac89b7281764', '1', '0.00', '0', '30', '1', '17430.00', '17400', '17400', '0', '1', '2026-10-09 10:51:03', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '48' ,'0','','','','','-1','0','0','0','0','0','17400','0','','0','0','17400','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=288
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','288', '0', '2026-10-09 10:51:03', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '17400', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:51:03','0','0','',''); -- id=395
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 204;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('370','01423', '288', '100', '1423', '15', '400', '6000', '0', '', '0', '2026-10-09 10:51:03', '1423', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','204-15,','1','1','0','0','400','6000','0','','0','0.00','0','0','0','0'); -- id=1062
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 367.50, lastbuyprice_withDiscount = 370.00, meanbuyprice_withDiscount = 367.50
        , lastbuyprice_withTax = 367.5, meanbuyprice_withTax = 367.5, lastbuyprice_withDiscountAndTax = 370
                where sellbilldetailid = 1062;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1423, '2026-10-09', 5989.6729776248, 5475, 5550
                    , 5512.5, 5550, 5512.5, 5550
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 5512.5, 5512.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5989.6729776248, sellCostBuyPrice =sellCostBuyPrice+5475
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5512.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5512.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5512.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5512.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-10-09', 5989.6729776248, 5475, 5550
                    , 5512.5, 5550, 5512.5, 5550
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5512.5, 5512.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5989.6729776248, sellCostBuyPrice =sellCostBuyPrice+5475
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5512.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5512.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5512.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5512.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 = '0', userid = '3', storedetaildate = '2026-10-09 10:51:03' WHERE storedetailid = '1436';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1423', '1', '15', '1', '288', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '0', '3', '2026-10-09 10:51:03','0','0'); -- id=3894
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 201;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('216','01452', '288', '101', '1452', '6', '240', '1440', '0', '', '0', '2026-10-09 10:51:03', '1452', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','201-6,','1','1','0','0','240','1440','0','','0','0.00','0','0','0','0'); -- id=1063
UPDATE sellbilldetail SET  lastbuyprice = 240.00 , meanbuyprice = 240.00, lastbuyprice_withDiscount = 216.00, meanbuyprice_withDiscount = 216.00
        , lastbuyprice_withTax = 240, meanbuyprice_withTax = 240, lastbuyprice_withDiscountAndTax = 216
                where sellbilldetailid = 1063;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1452, '2026-10-09', 1437.5215146299, 1440, 1440
                    , 1440, 1296, 1296, 1296
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1440, 1440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1437.5215146299, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1296, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1296
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1296
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1437.5215146299, 1440, 1440
                    , 1440, 1296, 1296, 1296
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1440, 1440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1437.5215146299, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1296, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1296
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1296
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '3', storedetaildate = '2026-10-09 10:51:03' WHERE storedetailid = '1469';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1452', '1', '6', '1', '288', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '21', '3', '2026-10-09 10:51:03','0','0'); -- id=3895
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+18 where id = 235;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01456', '288', '94', '1456', '18', '360', '6480', '0', '', '0', '2026-10-09 10:51:03', '1456', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','235-18,','1','1','0','0','360','6480','0','','0','0.00','0','0','0','0'); -- id=1064
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 1064;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1456, '2026-10-09', 6468.8468158348, 5760, 5760
                    , 5760, 5760, 5760, 5760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 0, 5760, 5760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6468.8468158348, sellCostBuyPrice =sellCostBuyPrice+5760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+18
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 6468.8468158348, 5760, 5760
                    , 5760, 5760, 5760, 5760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5760, 5760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6468.8468158348, sellCostBuyPrice =sellCostBuyPrice+5760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '210', userid = '3', storedetaildate = '2026-10-09 10:51:03' WHERE storedetailid = '1481';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1456', '1', '18', '1', '288', 'اضافة فاتورة مبيعات', 'sellbillController.php', '228', '210', '3', '2026-10-09 10:51:03','0','0'); -- id=3896
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 72;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01380', '288', '94', '1380', '9', '390', '3510', '0', '', '0', '2026-10-09 10:51:03', '1380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','72-9,','1','1','0','0','390','3510','0','','0','0.00','0','0','0','0'); -- id=1065
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1065;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-09', 3503.9586919105, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3503.9586919105, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3503.9586919105, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3503.9586919105, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '624', userid = '3', storedetaildate = '2026-10-09 10:51:03' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '9', '1', '288', 'اضافة فاتورة مبيعات', 'sellbillController.php', '633', '624', '3', '2026-10-09 10:51:03','0','0'); -- id=3897
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1659170',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1641770','17400', '0', '2', 'اضافة فاتورة مبيعات', '288', '1659170', '2026-10-09 10:51:03', '3',  'sellbillController.php','1','','0'); -- id=333
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '17430', '17430', '2026-10-09', '3', '0', '0', '2026-10-09 10:51:03','اضافة فاتورة مبيعات رقم 288','1','0',null,'0','288','sellbillController.php?do=showDetail&sellbillid=288'); -- id=1697
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1697', '419', '17400', '','0'); -- id=1725
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1659170', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1697', '398', '30', '','0'); -- id=1726
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '137443', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1697', '143', '17430', '','0'); -- id=1697
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3112610', 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 ( '15756', '15756', '2026-10-09', '3', '0', '0', '2026-10-09 10:51:03','اضافة فاتورة مبيعات رقم 288 - صرف البضاعة من المخزن','1','0',null,'0','288','sellbillController.php?do=showDetail&sellbillid=288'); -- id=1698
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1698', '402', '15756', '','0'); -- id=1727
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2929790.1', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1698', '382', '15756', '','0'); -- id=1698
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19821768.1', 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='1697,0,1698' where sellbillid=288;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 17400, 15825, 15900
                    , 15862.5, 15756, 15718.5, 15756
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15862.5, 15862.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17400, sellCostBuyPrice =sellCostBuyPrice+15825
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15862.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15756, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15718.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15756
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15862.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15862.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-10-09', 17400, 15825, 15900
                    , 15862.5, 15756, 15718.5, 15756
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15862.5, 15862.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17400, sellCostBuyPrice =sellCostBuyPrice+15825
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15862.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15756, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15718.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15756
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15862.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15862.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, 17400, 15825, 15900
                    , 15862.5, 15756, 15718.5, 15756, 15862.5, 15862.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+17400, netSellCostBuyPrice = netSellCostBuyPrice+15825
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+15900
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+15862.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+15756
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+15718.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+15756
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+15862.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+15862.5;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:21:03";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:51:03", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:51:03', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5643
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:21:06";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:51:06", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:51:06', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=288'); -- id=5644
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:23:12";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:53:12", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:53:12', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5645
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:23:12";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:53:12", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:53:12', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5646
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:23:55";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:53:55", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:53:55', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5647

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac89b5258671
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 10:53:55', '06ac89b5258671', '1', '0.00', '0', '0', '1', '2580.00', '2580', '2580', '0', '2', '2026-10-09 10:53:55', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '6' ,'0','','','','','-1','0','0','0','0','0','2580','0','','0','0','2580','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=289
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','289', '0', '2026-10-09 10:53:55', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2580', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:53:55','0','0','',''); -- id=396
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 493;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('370','01550', '289', '112', '1550', '6', '430', '2580', '0', '', '0', '2026-10-09 10:53:55', '1550', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','493-6,','1','1','0','0','430','2580','0','','0','0.00','0','0','0','0'); -- id=1066
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 370.00, meanbuyprice_withDiscount = 370.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 370
                where sellbilldetailid = 1066;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1550, '2026-10-09', 2580, 2220, 2220
                    , 2220, 2220, 2220, 2220
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2580, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 2580, 2220, 2220
                    , 2220, 2220, 2220, 2220
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2580, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '150', userid = '4', storedetaildate = '2026-10-09 10:53:55' WHERE storedetailid = '2562';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1550', '2', '6', '1', '289', 'اضافة فاتورة مبيعات', 'sellbillController.php', '156', '150', '4', '2026-10-09 10:53:55','0','0'); -- id=3898
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '399590',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('397010','2580', '0', '3', 'اضافة فاتورة مبيعات', '289', '399590', '2026-10-09 10:53:55', '4',  'sellbillController.php','1','','0'); -- id=334
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2580', '2580', '2026-10-09', '4', '0', '0', '2026-10-09 10:53:55','اضافة فاتورة مبيعات رقم 289','1','0',null,'0','289','sellbillController.php?do=showDetail&sellbillid=289'); -- id=1699
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1699', '501', '2580', '','0'); -- id=1728
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '399590', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1699', '143', '2580', '','0'); -- id=1699
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3115190', 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 ( '2220', '2220', '2026-10-09', '4', '0', '0', '2026-10-09 10:53:55','اضافة فاتورة مبيعات رقم 289 - صرف البضاعة من المخزن','1','0',null,'0','289','sellbillController.php?do=showDetail&sellbillid=289'); -- id=1700
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1700', '402', '2220', '','0'); -- id=1729
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2932010.1', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1700', '492', '2220', '','0'); -- id=1700
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '769045', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1699,0,1700' where sellbillid=289;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 2580, 2220, 2220
                    , 2220, 2220, 2220, 2220
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2580, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2580, 2220, 2220
                    , 2220, 2220, 2220, 2220
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2580, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, 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, 2580, 2220, 2220
                    , 2220, 2220, 2220, 2220, 2220, 2220)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2580, netSellCostBuyPrice = netSellCostBuyPrice+2220
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2220
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2220
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2220
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2220
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2220
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2220
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2220;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:23:55";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:53:55", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 10:53:55', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5648
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:27:53";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:57:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 10:57:53', '1', 'add', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=5649
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 ('قطيفه اوت فيت','','99','420','420','420','420','2026-10-09','0','1','0','','0','0','0','0','0','420','420','420','420','420','0','0','0','0','.','0','0','0','420','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','420','420','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','420','0','0','0','0','0','0','','','0','0','0','0'); -- id=1774
UPDATE product SET productName = 'قطيفه اوت فيت', productDescription = '', productCatId = '99', productBuyPrice = '420', productSellAllPrice = '420', productSellUnitPrice = '420', productSellHalfPrice = '420', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01774',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '420',lastbuyprice_withDiscount = '420',meanbuyprice = '420',meanbuyprice_withDiscount = '420' , productbuypricereal = '420' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='420',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='420',meanbuyprice_withTax='420',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='420',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1774';
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', '1774', '1.00', '2026-10-09', '1', '0','0177401','420','420','420','420','','0','0','0','0','0','0','0','0','0','0'); -- id=1774
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1774', '1', '0', '1', '2026-10-09'); -- id=2787
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1774', '1', '0', '0', '1774', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=3899
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1774, 1,'2026-10-09 10:57:53',1)
                ON DUPLICATE KEY UPDATE productid = 1774, edited = 1, sysdate = '2026-10-09 10:57:53', userid = 1; -- id=2679
UPDATE product SET productName = 'قطيفه اوت فيت', productDescription = '', productCatId = '99', productBuyPrice = '420.00', productSellAllPrice = '420.00', productSellUnitPrice = '420.00', productSellHalfPrice = '420.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01774',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '420',lastbuyprice_withDiscount = '420',meanbuyprice = '420',meanbuyprice_withDiscount = '420' , productbuypricereal = '420' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='420',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='420',meanbuyprice_withTax='420',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='420',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1774';
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 (' سوسته دبل اوت فيت','','99','500','500','500','500','2026-10-09','0','1','0','','0','0','0','0','0','500','500','500','500','500','0','0','0','0','.','0','0','0','500','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','500','500','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','500','0','0','0','0','0','0','','','0','0','0','0'); -- id=1775
UPDATE product SET productName = ' سوسته دبل اوت فيت', productDescription = '', productCatId = '99', productBuyPrice = '500', productSellAllPrice = '500', productSellUnitPrice = '500', productSellHalfPrice = '500', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01775',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '500',meanbuyprice = '500',meanbuyprice_withDiscount = '500' , productbuypricereal = '500' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',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='500',meanbuyprice_withTax='500',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='500',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1775';
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', '1775', '1.00', '2026-10-09', '1', '0','0177501','500','500','500','500','','0','0','0','0','0','0','0','0','0','0'); -- id=1775
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1775', '1', '0', '1', '2026-10-09'); -- id=2788
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1775', '1', '0', '0', '1775', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=3900
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1775, 1,'2026-10-09 10:57:53',1)
                ON DUPLICATE KEY UPDATE productid = 1775, edited = 1, sysdate = '2026-10-09 10:57:53', userid = 1; -- id=2680
UPDATE product SET productName = ' سوسته دبل اوت فيت', productDescription = '', productCatId = '99', productBuyPrice = '500.00', productSellAllPrice = '500.00', productSellUnitPrice = '500.00', productSellHalfPrice = '500.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01775',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '500',meanbuyprice = '500',meanbuyprice_withDiscount = '500' , productbuypricereal = '500' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',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='500',meanbuyprice_withTax='500',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='500',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1775';
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 ('هودي محجر اوت فيت','','99','450','450','450','450','2026-10-09','0','1','0','','0','0','0','0','0','450','450','450','450','450','0','0','0','0','.','0','0','0','450','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','450','450','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','450','0','0','0','0','0','0','','','0','0','0','0'); -- id=1776
UPDATE product SET productName = 'هودي محجر اوت فيت', productDescription = '', productCatId = '99', productBuyPrice = '450', productSellAllPrice = '450', productSellUnitPrice = '450', productSellHalfPrice = '450', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01776',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='450',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='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1776';
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', '1776', '1.00', '2026-10-09', '1', '0','0177601','450','450','450','450','','0','0','0','0','0','0','0','0','0','0'); -- id=1776
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1776', '1', '0', '1', '2026-10-09'); -- id=2789
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1776', '1', '0', '0', '1776', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=3901
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1776, 1,'2026-10-09 10:57:53',1)
                ON DUPLICATE KEY UPDATE productid = 1776, edited = 1, sysdate = '2026-10-09 10:57:53', userid = 1; -- id=2681
UPDATE product SET productName = 'هودي محجر اوت فيت', productDescription = '', productCatId = '99', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01776',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='450',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='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1776';
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 ('ياقيه تطعيم جوخ اوت فيت','','99','360','360','360','360','2026-10-09','0','1','0','','0','0','0','0','0','360','360','360','360','360','0','0','0','0','.','0','0','0','360','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','360','360','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','360','0','0','0','0','0','0','','','0','0','0','0'); -- id=1777
UPDATE product SET productName = 'ياقيه تطعيم جوخ اوت فيت', productDescription = '', productCatId = '99', productBuyPrice = '360', productSellAllPrice = '360', productSellUnitPrice = '360', productSellHalfPrice = '360', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01777',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360',lastbuyprice_withDiscount = '360',meanbuyprice = '360',meanbuyprice_withDiscount = '360' , productbuypricereal = '360' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='360',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='360',meanbuyprice_withTax='360',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='360',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1777';
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', '1777', '1.00', '2026-10-09', '1', '0','0177701','360','360','360','360','','0','0','0','0','0','0','0','0','0','0'); -- id=1777
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1777', '1', '0', '1', '2026-10-09'); -- id=2790
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1777', '1', '0', '0', '1777', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=3902
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1777, 1,'2026-10-09 10:57:53',1)
                ON DUPLICATE KEY UPDATE productid = 1777, edited = 1, sysdate = '2026-10-09 10:57:53', userid = 1; -- id=2682
UPDATE product SET productName = 'ياقيه تطعيم جوخ اوت فيت', productDescription = '', productCatId = '99', productBuyPrice = '360.00', productSellAllPrice = '360.00', productSellUnitPrice = '360.00', productSellHalfPrice = '360.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01777',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360',lastbuyprice_withDiscount = '360',meanbuyprice = '360',meanbuyprice_withDiscount = '360' , productbuypricereal = '360' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='360',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='360',meanbuyprice_withTax='360',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='360',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1777';
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 ('سوسته كروهات اوت فيت','','99','500','500','500','500','2026-10-09','0','1','0','','0','0','0','0','0','500','500','500','500','500','0','0','0','0','.','0','0','0','500','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','500','500','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','500','0','0','0','0','0','0','','','0','0','0','0'); -- id=1778
UPDATE product SET productName = 'سوسته كروهات اوت فيت', productDescription = '', productCatId = '99', productBuyPrice = '500', productSellAllPrice = '500', productSellUnitPrice = '500', productSellHalfPrice = '500', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01778',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '500',meanbuyprice = '500',meanbuyprice_withDiscount = '500' , productbuypricereal = '500' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',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='500',meanbuyprice_withTax='500',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='500',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1778';
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', '1778', '1.00', '2026-10-09', '1', '0','0177801','500','500','500','500','','0','0','0','0','0','0','0','0','0','0'); -- id=1778
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1778', '1', '0', '1', '2026-10-09'); -- id=2791
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1778', '1', '0', '0', '1778', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=3903
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1778, 1,'2026-10-09 10:57:53',1)
                ON DUPLICATE KEY UPDATE productid = 1778, edited = 1, sysdate = '2026-10-09 10:57:53', userid = 1; -- id=2683
UPDATE product SET productName = 'سوسته كروهات اوت فيت', productDescription = '', productCatId = '99', productBuyPrice = '500.00', productSellAllPrice = '500.00', productSellUnitPrice = '500.00', productSellHalfPrice = '500.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01778',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '500',meanbuyprice = '500',meanbuyprice_withDiscount = '500' , productbuypricereal = '500' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',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='500',meanbuyprice_withTax='500',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='500',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1778';
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 ('روند مقلم اوت فيت ','','99','280','280','280','280','2026-10-09','0','1','0','','0','0','0','0','0','280','280','280','280','280','0','0','0','0','.','0','0','0','280','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','280','280','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','280','0','0','0','0','0','0','','','0','0','0','0'); -- id=1779
UPDATE product SET productName = 'روند مقلم اوت فيت ', productDescription = '', productCatId = '99', productBuyPrice = '280', productSellAllPrice = '280', productSellUnitPrice = '280', productSellHalfPrice = '280', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01779',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280',lastbuyprice_withDiscount = '280',meanbuyprice = '280',meanbuyprice_withDiscount = '280' , productbuypricereal = '280' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='280',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='280',meanbuyprice_withTax='280',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='280',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1779';
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', '1779', '1.00', '2026-10-09', '1', '0','0177901','280','280','280','280','','0','0','0','0','0','0','0','0','0','0'); -- id=1779
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1779', '1', '0', '1', '2026-10-09'); -- id=2792
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1779', '1', '0', '0', '1779', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=3904
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1779, 1,'2026-10-09 10:57:53',1)
                ON DUPLICATE KEY UPDATE productid = 1779, edited = 1, sysdate = '2026-10-09 10:57:53', userid = 1; -- id=2684
UPDATE product SET productName = 'روند مقلم اوت فيت ', productDescription = '', productCatId = '99', productBuyPrice = '280.00', productSellAllPrice = '280.00', productSellUnitPrice = '280.00', productSellHalfPrice = '280.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01779',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280',lastbuyprice_withDiscount = '280',meanbuyprice = '280',meanbuyprice_withDiscount = '280' , productbuypricereal = '280' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='280',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='280',meanbuyprice_withTax='280',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='280',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1779';
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 ('سوسته ميلتون اوت فيت ','','99','280','280','280','280','2026-10-09','0','1','0','','0','0','0','0','0','280','280','280','280','280','0','0','0','0','.','0','0','0','280','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','280','280','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','280','0','0','0','0','0','0','','','0','0','0','0'); -- id=1780
UPDATE product SET productName = 'سوسته ميلتون اوت فيت ', productDescription = '', productCatId = '99', productBuyPrice = '280', productSellAllPrice = '280', productSellUnitPrice = '280', productSellHalfPrice = '280', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01780',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280',lastbuyprice_withDiscount = '280',meanbuyprice = '280',meanbuyprice_withDiscount = '280' , productbuypricereal = '280' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='280',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='280',meanbuyprice_withTax='280',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='280',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1780';
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', '1780', '1.00', '2026-10-09', '1', '0','0178001','280','280','280','280','','0','0','0','0','0','0','0','0','0','0'); -- id=1780
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1780', '1', '0', '1', '2026-10-09'); -- id=2793
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1780', '1', '0', '0', '1780', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=3905
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1780, 1,'2026-10-09 10:57:53',1)
                ON DUPLICATE KEY UPDATE productid = 1780, edited = 1, sysdate = '2026-10-09 10:57:53', userid = 1; -- id=2685
UPDATE product SET productName = 'سوسته ميلتون اوت فيت ', productDescription = '', productCatId = '99', productBuyPrice = '280.00', productSellAllPrice = '280.00', productSellUnitPrice = '280.00', productSellHalfPrice = '280.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01780',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280',lastbuyprice_withDiscount = '280',meanbuyprice = '280',meanbuyprice_withDiscount = '280' , productbuypricereal = '280' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='280',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='280',meanbuyprice_withTax='280',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='280',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1780';
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 ('زنط بوكس طباعه اوت فيت ','','99','420','420','420','420','2026-10-09','0','1','0','','0','0','0','0','0','420','420','420','420','420','0','0','0','0','.','0','0','0','420','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','420','420','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','420','0','0','0','0','0','0','','','0','0','0','0'); -- id=1781
UPDATE product SET productName = 'زنط بوكس طباعه اوت فيت ', productDescription = '', productCatId = '99', productBuyPrice = '420', productSellAllPrice = '420', productSellUnitPrice = '420', productSellHalfPrice = '420', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01781',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '420',lastbuyprice_withDiscount = '420',meanbuyprice = '420',meanbuyprice_withDiscount = '420' , productbuypricereal = '420' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='420',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='420',meanbuyprice_withTax='420',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='420',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1781';
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', '1781', '1.00', '2026-10-09', '1', '0','0178101','420','420','420','420','','0','0','0','0','0','0','0','0','0','0'); -- id=1781
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1781', '1', '0', '1', '2026-10-09'); -- id=2794
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1781', '1', '0', '0', '1781', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=3906
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1781, 1,'2026-10-09 10:57:53',1)
                ON DUPLICATE KEY UPDATE productid = 1781, edited = 1, sysdate = '2026-10-09 10:57:53', userid = 1; -- id=2686
UPDATE product SET productName = 'زنط بوكس طباعه اوت فيت ', productDescription = '', productCatId = '99', productBuyPrice = '420.00', productSellAllPrice = '420.00', productSellUnitPrice = '420.00', productSellHalfPrice = '420.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01781',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '420',lastbuyprice_withDiscount = '420',meanbuyprice = '420',meanbuyprice_withDiscount = '420' , productbuypricereal = '420' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='420',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='420',meanbuyprice_withTax='420',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='420',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1781';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:27:55";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:57:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 10:57:55', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=5650
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:27:57";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 10:57:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 10:57:57', '1', 'bill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=5651
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:30:12";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:00:12", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:00:12', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5652
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:31:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:01:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 11:01:32', '1', 'add', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=5653
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 ('06ac89e852d7d1', '2026-10-09 10:57:57', '82', '495170.00', '740330', '10', '1', '272400.00',  '245160.00', '0', '245160', '1', '2026-10-09 11:01:32', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=89
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 ('01774', '89', '99', '1774', '120', '420', '50400.00', '0', '', '2026-10-09 11:01:32', '1774','','','0','0','0','0','0',null,'420','50400','0','0','0','0','0','0','0','0','1'); -- id=574
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 10:57:57', 1, 1774, 0, 0
                    , 378, 120, 0, 0, 1, '2026-10-09 11:01:32')
                ON DUPLICATE KEY UPDATE buyprice = 378,
                        buyQuantity =buyQuantity+120, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 11:01:32' ; -- id=732
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1774', '420', '120', '0', 'buyBillController.php', '574', '', '0', '0'); -- id=457
UPDATE product SET  productBuyPrice = "420" WHERE productId = 1774 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 574 ;
UPDATE product SET productName = 'قطيفه اوت فيت', productDescription = '', productCatId = '99', productBuyPrice = '420.00', productSellAllPrice = '420.00', productSellUnitPrice = '420.00', productSellHalfPrice = '420.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01774',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '420',lastbuyprice_withDiscount = '378',meanbuyprice = '420',meanbuyprice_withDiscount = '378' , productbuypricereal = '420.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='420',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='420',meanbuyprice_withTax='420',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='378',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1774';
UPDATE buybilldetail SET  lastbuyprice = 420 , meanbuyprice = 420, lastbuyprice_withDiscount = 378, meanbuyprice_withDiscount = 378
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 378
                where buybilldetailid = 574;
UPDATE productunit SET proUnitBuyPrice  = 420 * productnumber WHERE productid = 1774;
UPDATE storedetail SET  productquantity = '120', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2787';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1774', '1', '120', '0', '89', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '120', '1', '2026-10-09 10:57:57','0','0'); -- id=3907
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 ('01775', '89', '99', '1775', '124', '500', '62000.00', '0', '', '2026-10-09 11:01:32', '1775','','','0','0','0','0','0',null,'500','62000','0','0','0','0','0','0','0','0','1'); -- id=575
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 10:57:57', 1, 1775, 0, 0
                    , 450, 124, 0, 0, 1, '2026-10-09 11:01:32')
                ON DUPLICATE KEY UPDATE buyprice = 450,
                        buyQuantity =buyQuantity+124, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 11:01:32' ; -- id=733
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1775', '500', '124', '0', 'buyBillController.php', '575', '', '0', '0'); -- id=458
UPDATE product SET  productBuyPrice = "500" WHERE productId = 1775 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 575 ;
UPDATE product SET productName = ' سوسته دبل اوت فيت', productDescription = '', productCatId = '99', productBuyPrice = '500.00', productSellAllPrice = '500.00', productSellUnitPrice = '500.00', productSellHalfPrice = '500.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01775',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '450',meanbuyprice = '500',meanbuyprice_withDiscount = '450' , productbuypricereal = '500.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',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='500',meanbuyprice_withTax='500',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='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1775';
UPDATE buybilldetail SET  lastbuyprice = 500 , meanbuyprice = 500, lastbuyprice_withDiscount = 450, meanbuyprice_withDiscount = 450
        , lastbuyprice_withTax = 500, meanbuyprice_withTax = 500, lastbuyprice_withDiscountAndTax = 450
                where buybilldetailid = 575;
UPDATE productunit SET proUnitBuyPrice  = 500 * productnumber WHERE productid = 1775;
UPDATE storedetail SET  productquantity = '124', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2788';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1775', '1', '124', '0', '89', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '124', '1', '2026-10-09 10:57:57','0','0'); -- id=3908
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 ('01776', '89', '99', '1776', '24', '450', '10800.00', '0', '', '2026-10-09 11:01:32', '1776','','','0','0','0','0','0',null,'450','10800','0','0','0','0','0','0','0','0','1'); -- id=576
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 10:57:57', 1, 1776, 0, 0
                    , 405, 24, 0, 0, 1, '2026-10-09 11:01:32')
                ON DUPLICATE KEY UPDATE buyprice = 405,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 11:01:32' ; -- id=734
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1776', '450', '24', '0', 'buyBillController.php', '576', '', '0', '0'); -- id=459
UPDATE product SET  productBuyPrice = "450" WHERE productId = 1776 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 576 ;
UPDATE product SET productName = 'هودي محجر اوت فيت', productDescription = '', productCatId = '99', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01776',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '405',meanbuyprice = '450',meanbuyprice_withDiscount = '405' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='450',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='405',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1776';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 405, meanbuyprice_withDiscount = 405
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 405
                where buybilldetailid = 576;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 1776;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2789';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1776', '1', '24', '0', '89', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 10:57:57','0','0'); -- id=3909
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 ('01777', '89', '99', '1777', '144', '360', '51840.00', '0', '', '2026-10-09 11:01:32', '1777','','','0','0','0','0','0',null,'360','51840','0','0','0','0','0','0','0','0','1'); -- id=577
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 10:57:57', 1, 1777, 0, 0
                    , 324, 144, 0, 0, 1, '2026-10-09 11:01:32')
                ON DUPLICATE KEY UPDATE buyprice = 324,
                        buyQuantity =buyQuantity+144, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 11:01:32' ; -- id=735
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1777', '360', '144', '0', 'buyBillController.php', '577', '', '0', '0'); -- id=460
UPDATE product SET  productBuyPrice = "360" WHERE productId = 1777 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 577 ;
UPDATE product SET productName = 'ياقيه تطعيم جوخ اوت فيت', productDescription = '', productCatId = '99', productBuyPrice = '360.00', productSellAllPrice = '360.00', productSellUnitPrice = '360.00', productSellHalfPrice = '360.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01777',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360',lastbuyprice_withDiscount = '324',meanbuyprice = '360',meanbuyprice_withDiscount = '324' , productbuypricereal = '360.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='360',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='360',meanbuyprice_withTax='360',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='324',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1777';
UPDATE buybilldetail SET  lastbuyprice = 360 , meanbuyprice = 360, lastbuyprice_withDiscount = 324, meanbuyprice_withDiscount = 324
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 324
                where buybilldetailid = 577;
UPDATE productunit SET proUnitBuyPrice  = 360 * productnumber WHERE productid = 1777;
UPDATE storedetail SET  productquantity = '144', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2790';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1777', '1', '144', '0', '89', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '144', '1', '2026-10-09 10:57:57','0','0'); -- id=3910
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 ('01778', '89', '99', '1778', '48', '500', '24000.00', '0', '', '2026-10-09 11:01:32', '1778','','','0','0','0','0','0',null,'500','24000','0','0','0','0','0','0','0','0','1'); -- id=578
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 10:57:57', 1, 1778, 0, 0
                    , 450, 48, 0, 0, 1, '2026-10-09 11:01:32')
                ON DUPLICATE KEY UPDATE buyprice = 450,
                        buyQuantity =buyQuantity+48, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 11:01:32' ; -- id=736
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1778', '500', '48', '0', 'buyBillController.php', '578', '', '0', '0'); -- id=461
UPDATE product SET  productBuyPrice = "500" WHERE productId = 1778 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 578 ;
UPDATE product SET productName = 'سوسته كروهات اوت فيت', productDescription = '', productCatId = '99', productBuyPrice = '500.00', productSellAllPrice = '500.00', productSellUnitPrice = '500.00', productSellHalfPrice = '500.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01778',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '450',meanbuyprice = '500',meanbuyprice_withDiscount = '450' , productbuypricereal = '500.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',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='500',meanbuyprice_withTax='500',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='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1778';
UPDATE buybilldetail SET  lastbuyprice = 500 , meanbuyprice = 500, lastbuyprice_withDiscount = 450, meanbuyprice_withDiscount = 450
        , lastbuyprice_withTax = 500, meanbuyprice_withTax = 500, lastbuyprice_withDiscountAndTax = 450
                where buybilldetailid = 578;
UPDATE productunit SET proUnitBuyPrice  = 500 * productnumber WHERE productid = 1778;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2791';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1778', '1', '48', '0', '89', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '48', '1', '2026-10-09 10:57:57','0','0'); -- id=3911
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 ('01779', '89', '99', '1779', '70', '280', '19600.00', '0', '', '2026-10-09 11:01:32', '1779','','','0','0','0','0','0',null,'280','19600','0','0','0','0','0','0','0','0','1'); -- id=579
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 10:57:57', 1, 1779, 0, 0
                    , 252, 70, 0, 0, 1, '2026-10-09 11:01:32')
                ON DUPLICATE KEY UPDATE buyprice = 252,
                        buyQuantity =buyQuantity+70, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 11:01:32' ; -- id=737
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1779', '280', '70', '0', 'buyBillController.php', '579', '', '0', '0'); -- id=462
UPDATE product SET  productBuyPrice = "280" WHERE productId = 1779 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 579 ;
UPDATE product SET productName = 'روند مقلم اوت فيت ', productDescription = '', productCatId = '99', productBuyPrice = '280.00', productSellAllPrice = '280.00', productSellUnitPrice = '280.00', productSellHalfPrice = '280.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01779',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280',lastbuyprice_withDiscount = '252',meanbuyprice = '280',meanbuyprice_withDiscount = '252' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='280',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='280',meanbuyprice_withTax='280',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='252',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1779';
UPDATE buybilldetail SET  lastbuyprice = 280 , meanbuyprice = 280, lastbuyprice_withDiscount = 252, meanbuyprice_withDiscount = 252
        , lastbuyprice_withTax = 280, meanbuyprice_withTax = 280, lastbuyprice_withDiscountAndTax = 252
                where buybilldetailid = 579;
UPDATE productunit SET proUnitBuyPrice  = 280 * productnumber WHERE productid = 1779;
UPDATE storedetail SET  productquantity = '70', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2792';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1779', '1', '70', '0', '89', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '70', '1', '2026-10-09 10:57:57','0','0'); -- id=3912
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 ('01780', '89', '99', '1780', '48', '280', '13440.00', '0', '', '2026-10-09 11:01:32', '1780','','','0','0','0','0','0',null,'280','13440','0','0','0','0','0','0','0','0','1'); -- id=580
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 10:57:57', 1, 1780, 0, 0
                    , 252, 48, 0, 0, 1, '2026-10-09 11:01:32')
                ON DUPLICATE KEY UPDATE buyprice = 252,
                        buyQuantity =buyQuantity+48, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 11:01:32' ; -- id=738
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1780', '280', '48', '0', 'buyBillController.php', '580', '', '0', '0'); -- id=463
UPDATE product SET  productBuyPrice = "280" WHERE productId = 1780 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 580 ;
UPDATE product SET productName = 'سوسته ميلتون اوت فيت ', productDescription = '', productCatId = '99', productBuyPrice = '280.00', productSellAllPrice = '280.00', productSellUnitPrice = '280.00', productSellHalfPrice = '280.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01780',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280',lastbuyprice_withDiscount = '252',meanbuyprice = '280',meanbuyprice_withDiscount = '252' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='280',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='280',meanbuyprice_withTax='280',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='252',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1780';
UPDATE buybilldetail SET  lastbuyprice = 280 , meanbuyprice = 280, lastbuyprice_withDiscount = 252, meanbuyprice_withDiscount = 252
        , lastbuyprice_withTax = 280, meanbuyprice_withTax = 280, lastbuyprice_withDiscountAndTax = 252
                where buybilldetailid = 580;
UPDATE productunit SET proUnitBuyPrice  = 280 * productnumber WHERE productid = 1780;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2793';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1780', '1', '48', '0', '89', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '48', '1', '2026-10-09 10:57:57','0','0'); -- id=3913
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 ('01781', '89', '99', '1781', '96', '420', '40320.00', '0', '', '2026-10-09 11:01:32', '1781','','','0','0','0','0','0',null,'420','40320','0','0','0','0','0','0','0','0','1'); -- id=581
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 10:57:57', 1, 1781, 0, 0
                    , 378, 96, 0, 0, 1, '2026-10-09 11:01:32')
                ON DUPLICATE KEY UPDATE buyprice = 378,
                        buyQuantity =buyQuantity+96, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 11:01:32' ; -- id=739
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1781', '420', '96', '0', 'buyBillController.php', '581', '', '0', '0'); -- id=464
UPDATE product SET  productBuyPrice = "420" WHERE productId = 1781 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 581 ;
UPDATE product SET productName = 'زنط بوكس طباعه اوت فيت ', productDescription = '', productCatId = '99', productBuyPrice = '420.00', productSellAllPrice = '420.00', productSellUnitPrice = '420.00', productSellHalfPrice = '420.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01781',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '420',lastbuyprice_withDiscount = '378',meanbuyprice = '420',meanbuyprice_withDiscount = '378' , productbuypricereal = '420.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='420',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='420',meanbuyprice_withTax='420',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='378',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1781';
UPDATE buybilldetail SET  lastbuyprice = 420 , meanbuyprice = 420, lastbuyprice_withDiscount = 378, meanbuyprice_withDiscount = 378
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 378
                where buybilldetailid = 581;
UPDATE productunit SET proUnitBuyPrice  = 420 * productnumber WHERE productid = 1781;
UPDATE storedetail SET  productquantity = '96', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2794';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1781', '1', '96', '0', '89', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '96', '1', '2026-10-09 10:57:57','0','0'); -- id=3914
UPDATE supplier SET  suppliercurrentDebt = '740330',suppliercurrentDebtInCurrency= '740330' , userid = '1', supplierdate = '2026-10-09 11:01:32'   WHERE supplierid = '82';
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 ('82', '495170.00', '245160', '0', 'اضافة فاتورة مشتريات', '89', '740330', '2026-10-09 10:57:57', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','245160','1','495170','245160','740330','0',''); -- id=282
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '245160', '245160', '2026-10-09', '1', '0', '0', '2026-10-09 11:01:32','اضافة فاتورة مشتريات رقم 89','1','0',null,'0','89','buyBillController.php?do=details&id=89'); -- id=1701
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1701', '382', '245160', '','0'); -- id=1730
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20066928.1', 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 ('1701', '560', '245160', '','0'); -- id=1701
UPDATE accountstree SET name = 'اوت فيت', customName = 'اوت فيت', customNameEn = 'اوت فيت', nameEn = 'اوت فيت', parent = '81', accountNature = '1', theValue = '740330', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-03 18:26:01' WHERE id = '560';
update buybill set dailyentryid='1701,0' where buybillid=89;
COMMIT;
UPDATE product SET overAllAveragePrice = 378 WHERE productId = 1774;UPDATE product SET overAllAveragePrice = 450 WHERE productId = 1775;UPDATE product SET overAllAveragePrice = 405 WHERE productId = 1776;UPDATE product SET overAllAveragePrice = 324 WHERE productId = 1777;UPDATE product SET overAllAveragePrice = 450 WHERE productId = 1778;UPDATE product SET overAllAveragePrice = 252 WHERE productId = 1779;UPDATE product SET overAllAveragePrice = 252 WHERE productId = 1780;UPDATE product SET overAllAveragePrice = 378 WHERE productId = 1781;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:31:33";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:01:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 11:01:33', '1', 'editprint', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=89'); -- id=5654
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:31:35";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:01:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 11:01:35', '1', 'showbarcodebuybill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=89&type=2'); -- id=5655
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:34:19";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:04:19", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:04:19', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5656

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac89d68ef6e2
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 11:04:19', '06ac89d68ef6e2', '1', '0.00', '0', '0', '1', '1200.00', '1200', '1200', '0', '1', '2026-10-09 11:04:19', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '3' ,'0','','','','','-1','0','0','0','0','0','1200','0','','0','0','1200','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=290
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','290', '0', '2026-10-09 11:04:19', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1200', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 11:04:19','0','0','',''); -- id=397
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 425;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('372','01584', '290', '115', '1584', '3', '400', '1200', '0', '', '0', '2026-10-09 11:04:19', '1584', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','425-3,','1','1','0','0','400','1200','0','','0','0.00','0','0','0','0'); -- id=1067
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 372.00, meanbuyprice_withDiscount = 372.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 372
                where sellbilldetailid = 1067;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1584, '2026-10-09', 1200, 1200, 1200
                    , 1200, 1116, 1116, 1116
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1116, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1116
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1116
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1200, 1200, 1200
                    , 1200, 1116, 1116, 1116
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1116, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1116
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1116
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '57', userid = '3', storedetaildate = '2026-10-09 11:04:19' WHERE storedetailid = '1609';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1584', '1', '3', '1', '290', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60', '57', '3', '2026-10-09 11:04:19','0','0'); -- id=3915
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1660370',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1659170','1200', '0', '2', 'اضافة فاتورة مبيعات', '290', '1660370', '2026-10-09 11:04:19', '3',  'sellbillController.php','1','','0'); -- id=335
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1200', '1200', '2026-10-09', '3', '0', '0', '2026-10-09 11:04:19','اضافة فاتورة مبيعات رقم 290','1','0',null,'0','290','sellbillController.php?do=showDetail&sellbillid=290'); -- id=1702
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1702', '419', '1200', '','0'); -- id=1731
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1660370', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1702', '143', '1200', '','0'); -- id=1702
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3116390', 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 ( '1116', '1116', '2026-10-09', '3', '0', '0', '2026-10-09 11:04:19','اضافة فاتورة مبيعات رقم 290 - صرف البضاعة من المخزن','1','0',null,'0','290','sellbillController.php?do=showDetail&sellbillid=290'); -- id=1703
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1703', '402', '1116', '','0'); -- id=1732
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2933126.1', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1703', '382', '1116', '','0'); -- id=1703
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20065812.1', 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='1702,0,1703' where sellbillid=290;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 1200, 1200, 1200
                    , 1200, 1116, 1116, 1116
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1116, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1116
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1116
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1200, 1200, 1200
                    , 1200, 1116, 1116, 1116
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1116, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1116
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1116
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, 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, 1200, 1200, 1200
                    , 1200, 1116, 1116, 1116, 1200, 1200)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1200, netSellCostBuyPrice = netSellCostBuyPrice+1200
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1200
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1200
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1116
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1116
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1116
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1200
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1200;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:34:20";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:04:20", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:04:20', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5657
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:34:22";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:04:22", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:04:22', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=290'); -- id=5658
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:34:22";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:04:22", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:04:22', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=290'); -- id=5659
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:34:33";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:04:33", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:04:33', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5660
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:34:33";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:04:33", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:04:33', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5661
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:34:59";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:04:59", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:04:59', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5662

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8a0119459f
-- ----------------------------------------------------------------------------------------------------

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

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:35:00";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:05:00", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:05:00', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5663
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:35:02";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:05:03", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:05:03', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=291'); -- id=5664
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:35:19";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:05:19", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:05:19', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5665
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:35:19";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:05:19", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:05:19', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5666
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:37:06";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:07:06", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:07:06', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5667

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac89f0c5809e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 11:07:06', '06ac89f0c5809e', '1', '0.00', '0', '0', '1', '34385.00', '34385', '34385', '0', '1', '2026-10-09 11:07:06', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '60' ,'0','','','','','-1','0','0','0','0','0','34385','0','','0','0','34385','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=292
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','292', '0', '2026-10-09 11:07:06', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '34385', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 11:07:06','0','0','',''); -- id=399
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 370;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('637','i0001552', '292', '8', '1552', '5', '665', '3325', '0', '', '0', '2026-10-09 11:07:06', '1552', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','370-5,','1','1','0','0','665','3325','0','','0','0.00','0','0','0','0'); -- id=1069
UPDATE sellbilldetail SET  lastbuyprice = 637.00 , meanbuyprice = 637.00, lastbuyprice_withDiscount = 637.00, meanbuyprice_withDiscount = 637.00
        , lastbuyprice_withTax = 637, meanbuyprice_withTax = 637, lastbuyprice_withDiscountAndTax = 637
                where sellbilldetailid = 1069;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1552, '2026-10-09', 3325, 3185, 3185
                    , 3185, 3185, 3185, 3185
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 3185, 3185, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3325, sellCostBuyPrice =sellCostBuyPrice+3185
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3185
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3185
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3185
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3185
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3325, 3185, 3185
                    , 3185, 3185, 3185, 3185
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3185, 3185, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3325, sellCostBuyPrice =sellCostBuyPrice+3185
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3185
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3185
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3185
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3185
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 11:07:06' WHERE storedetailid = '1577';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1552', '1', '5', '1', '292', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5', '0', '2', '2026-10-09 11:07:06','0','0'); -- id=3917
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 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 ('430','07429', '292', '19', '833', '5', '450', '2250', '0', '', '0', '2026-10-09 11:07:06', '833', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','7-5,','1','1','0','0','450','2250','0','','0','0.00','0','0','0','0'); -- id=1070
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 1070;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (833, '2026-10-09', 2250, 2150, 2150
                    , 2150, 2150, 2150, 2150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2150, 2150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2250, sellCostBuyPrice =sellCostBuyPrice+2150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2250, 2150, 2150
                    , 2150, 2150, 2150, 2150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2150, 2150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2250, sellCostBuyPrice =sellCostBuyPrice+2150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '25', userid = '2', storedetaildate = '2026-10-09 11:07:06' WHERE storedetailid = '833';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('833', '1', '5', '1', '292', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '25', '2', '2026-10-09 11:07:06','0','0'); -- id=3918
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 372;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('532','01554', '292', '8', '1554', '5', '560', '2800', '0', '', '0', '2026-10-09 11:07:06', '1554', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','372-5,','1','1','0','0','560','2800','0','','0','0.00','0','0','0','0'); -- id=1071
UPDATE sellbilldetail SET  lastbuyprice = 532.00 , meanbuyprice = 532.00, lastbuyprice_withDiscount = 532.00, meanbuyprice_withDiscount = 532.00
        , lastbuyprice_withTax = 532, meanbuyprice_withTax = 532, lastbuyprice_withDiscountAndTax = 532
                where sellbilldetailid = 1071;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1554, '2026-10-09', 2800, 2660, 2660
                    , 2660, 2660, 2660, 2660
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2660, 2660, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2800, sellCostBuyPrice =sellCostBuyPrice+2660
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2660, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2660
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2660, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2660
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2660
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2660
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2660
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2800, 2660, 2660
                    , 2660, 2660, 2660, 2660
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2660, 2660, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2800, sellCostBuyPrice =sellCostBuyPrice+2660
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2660, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2660
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2660, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2660
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2660
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2660
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2660
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '2', storedetaildate = '2026-10-09 11:07:06' WHERE storedetailid = '1579';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1554', '1', '5', '1', '292', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '15', '2', '2026-10-09 11:07:06','0','0'); -- id=3919
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 70;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01378', '292', '94', '1378', '15', '360', '5400', '0', '', '0', '2026-10-09 11:07:06', '1378', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','70-15,','1','1','0','0','360','5400','0','','0','0.00','0','0','0','0'); -- id=1072
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 1072;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1378, '2026-10-09', 5400, 4800, 4800
                    , 4800, 4800, 4800, 4800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 4800, 4800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5400, sellCostBuyPrice =sellCostBuyPrice+4800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-10-09', 5400, 4800, 4800
                    , 4800, 4800, 4800, 4800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4800, 4800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5400, sellCostBuyPrice =sellCostBuyPrice+4800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '624', userid = '2', storedetaildate = '2026-10-09 11:07:06' WHERE storedetailid = '1378';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1378', '1', '15', '1', '292', 'اضافة فاتورة مبيعات', 'sellbillController.php', '639', '624', '2', '2026-10-09 11:07:06','0','0'); -- id=3920
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 76;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('441','01384', '292', '95', '1384', '9', '490', '4410', '0', '', '0', '2026-10-09 11:07:06', '1384', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','76-9,','1','1','0','0','490','4410','0','','0','0.00','0','0','0','0'); -- id=1073
UPDATE sellbilldetail SET  lastbuyprice = 490.00 , meanbuyprice = 490.00, lastbuyprice_withDiscount = 441.00, meanbuyprice_withDiscount = 465.50
        , lastbuyprice_withTax = 490, meanbuyprice_withTax = 245, lastbuyprice_withDiscountAndTax = 441
                where sellbilldetailid = 1073;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1384, '2026-10-09', 4410, 4410, 4410
                    , 4410, 3969, 4189.5, 3969
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4410, 2205, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4410, sellCostBuyPrice =sellCostBuyPrice+4410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3969, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4189.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3969
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4410
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2205
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4410, 4410, 4410
                    , 4410, 3969, 4189.5, 3969
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4410, 2205, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4410, sellCostBuyPrice =sellCostBuyPrice+4410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3969, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4189.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3969
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4410
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2205
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '279', userid = '2', storedetaildate = '2026-10-09 11:07:06' WHERE storedetailid = '1384';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1384', '1', '9', '1', '292', 'اضافة فاتورة مبيعات', 'sellbillController.php', '288', '279', '2', '2026-10-09 11:07:06','0','0'); -- id=3921
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 74;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','01382', '292', '94', '1382', '9', '400', '3600', '0', '', '0', '2026-10-09 11:07:06', '1382', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','74-9,','1','1','0','0','400','3600','0','','0','0.00','0','0','0','0'); -- id=1074
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1074;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1382, '2026-10-09', 3600, 3240, 3240
                    , 3240, 3240, 3240, 3240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3600, 3240, 3240
                    , 3240, 3240, 3240, 3240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '114', userid = '2', storedetaildate = '2026-10-09 11:07:06' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '9', '1', '292', 'اضافة فاتورة مبيعات', 'sellbillController.php', '123', '114', '2', '2026-10-09 11:07:06','0','0'); -- id=3922
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 683;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('980','01769', '292', '137', '1769', '12', '1050', '12600', '0', '', '0', '2026-10-09 11:07:06', '1769', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','683-12,','1','1','0','0','1050','12600','0','','0','0.00','0','0','0','0'); -- id=1075
UPDATE sellbilldetail SET  lastbuyprice = 980.00 , meanbuyprice = 980.00, lastbuyprice_withDiscount = 980.00, meanbuyprice_withDiscount = 980.00
        , lastbuyprice_withTax = 980, meanbuyprice_withTax = 980, lastbuyprice_withDiscountAndTax = 980
                where sellbilldetailid = 1075;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1769, '2026-10-09', 12600, 11760, 11760
                    , 11760, 11760, 11760, 11760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 11760, 11760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12600, sellCostBuyPrice =sellCostBuyPrice+11760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 12600, 11760, 11760
                    , 11760, 11760, 11760, 11760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11760, 11760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12600, sellCostBuyPrice =sellCostBuyPrice+11760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 11:07:06' WHERE storedetailid = '2782';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1769', '1', '12', '1', '292', 'اضافة فاتورة مبيعات', 'sellbillController.php', '32', '20', '2', '2026-10-09 11:07:06','0','0'); -- id=3923
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1697155',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1662770','34385', '0', '2', 'اضافة فاتورة مبيعات', '292', '1697155', '2026-10-09 11:07:06', '2',  'sellbillController.php','1','','0'); -- id=337
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '34385', '34385', '2026-10-09', '2', '0', '0', '2026-10-09 11:07:06','اضافة فاتورة مبيعات رقم 292','1','0',null,'0','292','sellbillController.php?do=showDetail&sellbillid=292'); -- id=1706
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1706', '419', '34385', '','0'); -- id=1735
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1697155', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1706', '143', '34385', '','0'); -- id=1706
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3153175', 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 ( '31764', '31764', '2026-10-09', '2', '0', '0', '2026-10-09 11:07:06','اضافة فاتورة مبيعات رقم 292 - صرف البضاعة من المخزن','1','0',null,'0','292','sellbillController.php?do=showDetail&sellbillid=292'); -- id=1707
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1707', '402', '31764', '','0'); -- id=1736
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2967122.1', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1707', '382', '31764', '','0'); -- id=1707
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20031816.1', 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='1706,0,1707' where sellbillid=292;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 34385, 32205, 32205
                    , 32205, 31764, 31984.5, 31764
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,32205, 30000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+34385, sellCostBuyPrice =sellCostBuyPrice+32205
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+32205, sellCostMeanBuyPrice = sellCostMeanBuyPrice+32205
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+31764, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+31984.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+31764
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+32205
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+30000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 34385, 32205, 32205
                    , 32205, 31764, 31984.5, 31764
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,32205, 30000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+34385, sellCostBuyPrice =sellCostBuyPrice+32205
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+32205, sellCostMeanBuyPrice = sellCostMeanBuyPrice+32205
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+31764, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+31984.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+31764
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+32205
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+30000
                        , returnSellVal = returnSellVal+0, 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, 34385, 32205, 32205
                    , 32205, 31764, 31984.5, 31764, 32205, 30000)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+34385, netSellCostBuyPrice = netSellCostBuyPrice+32205
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+32205
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+32205
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+31764
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+31984.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+31764
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+32205
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+30000;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:37:07";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:07:07", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:07:07', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5668
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:37:40";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:07:40", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:07:40', '2', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=292'); -- id=5669
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:38:15";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:08:15", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:08:15', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5670
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:52:03";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:22:03", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:22:03', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5671

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac89d93dcfcb
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 11:22:03', '06ac89d93dcfcb', '1', '0.00', '0', '0', '1', '1720.00', '1720', '1720', '0', '2', '2026-10-09 11:22:03', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '4' ,'0','','','','','-1','0','0','0','0','0','1720','0','','0','0','1720','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=293
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','293', '0', '2026-10-09 11:22:03', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1720', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 11:22:03','0','0','',''); -- id=400
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 220;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('400','01439', '293', '88', '1439', '4', '430', '1720', '0', '', '0', '2026-10-09 11:22:03', '1439', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','220-4,','1','1','0','0','430','1720','0','','0','0.00','0','0','0','0'); -- id=1076
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 400.00, meanbuyprice_withDiscount = 400.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 400
                where sellbilldetailid = 1076;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1439, '2026-10-09', 1720, 1600, 1600
                    , 1600, 1600, 1600, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1600, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1720, sellCostBuyPrice =sellCostBuyPrice+1600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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 (2, '2026-10-09', 1720, 1600, 1600
                    , 1600, 1600, 1600, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1600, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1720, sellCostBuyPrice =sellCostBuyPrice+1600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '4', userid = '4', storedetaildate = '2026-10-09 11:22:03' WHERE storedetailid = '1470';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1439', '2', '4', '1', '293', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8', '4', '4', '2026-10-09 11:22:03','0','0'); -- id=3924
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '401310',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('399590','1720', '0', '3', 'اضافة فاتورة مبيعات', '293', '401310', '2026-10-09 11:22:03', '4',  'sellbillController.php','1','','0'); -- id=338
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1720', '1720', '2026-10-09', '4', '0', '0', '2026-10-09 11:22:03','اضافة فاتورة مبيعات رقم 293','1','0',null,'0','293','sellbillController.php?do=showDetail&sellbillid=293'); -- id=1708
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1708', '501', '1720', '','0'); -- id=1737
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '401310', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1708', '143', '1720', '','0'); -- id=1708
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3154895', 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 ( '1600', '1600', '2026-10-09', '4', '0', '0', '2026-10-09 11:22:03','اضافة فاتورة مبيعات رقم 293 - صرف البضاعة من المخزن','1','0',null,'0','293','sellbillController.php?do=showDetail&sellbillid=293'); -- id=1709
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1709', '402', '1600', '','0'); -- id=1738
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2968722.1', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1709', '492', '1600', '','0'); -- id=1709
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '767445', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1708,0,1709' where sellbillid=293;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 1720, 1600, 1600
                    , 1600, 1600, 1600, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1600, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1720, sellCostBuyPrice =sellCostBuyPrice+1600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1720, 1600, 1600
                    , 1600, 1600, 1600, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1600, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1720, sellCostBuyPrice =sellCostBuyPrice+1600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 1720, 1600, 1600
                    , 1600, 1600, 1600, 1600, 1600, 1600)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1720, netSellCostBuyPrice = netSellCostBuyPrice+1600
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1600
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1600
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1600
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1600
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1600
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1600
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1600;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:52:03";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:22:03", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:22:03', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5672
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:52:03";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:22:03", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:22:03', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5673

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8a03fca899
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 11:22:03', '06ac8a03fca899', '1', '0.00', '0', '0', '1', '4050.00', '4050', '4050', '0', '1', '2026-10-09 11:22:03', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '9' ,'0','','','','','-1','0','0','0','0','0','4050','0','','0','0','4050','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=294
UPDATE client SET  clientdebt = '0', userid = '3' 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','اضافة فاتورة مبيعات','294', '0', '2026-10-09 11:22:03', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '4050', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 11:22:03','0','0','',''); -- id=401
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 555;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','01691', '294', '126', '1691', '9', '450', '4050', '0', '', '0', '2026-10-09 11:22:03', '1691', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','555-9,','1','1','0','0','450','4050','0','','0','0.00','0','0','0','0'); -- id=1077
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1077;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1691, '2026-10-09', 4050, 4050, 4050
                    , 4050, 3726, 3726, 3726
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3726, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3726
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3726
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4050, 4050, 4050
                    , 4050, 3726, 3726, 3726
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3726, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3726
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3726
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '3', storedetaildate = '2026-10-09 11:22:03' WHERE storedetailid = '2703';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1691', '1', '9', '1', '294', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '15', '3', '2026-10-09 11:22:03','0','0'); -- id=3925
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1701205',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1697155','4050', '0', '2', 'اضافة فاتورة مبيعات', '294', '1701205', '2026-10-09 11:22:03', '3',  'sellbillController.php','1','','0'); -- id=339
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4050', '4050', '2026-10-09', '3', '0', '0', '2026-10-09 11:22:03','اضافة فاتورة مبيعات رقم 294','1','0',null,'0','294','sellbillController.php?do=showDetail&sellbillid=294'); -- id=1710
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1710', '419', '4050', '','0'); -- id=1739
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1701205', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1710', '143', '4050', '','0'); -- id=1710
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3158945', 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 ( '3726', '3726', '2026-10-09', '3', '0', '0', '2026-10-09 11:22:03','اضافة فاتورة مبيعات رقم 294 - صرف البضاعة من المخزن','1','0',null,'0','294','sellbillController.php?do=showDetail&sellbillid=294'); -- id=1711
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1711', '402', '3726', '','0'); -- id=1740
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2972448.1', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1711', '382', '3726', '','0'); -- id=1711
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20028090.1', 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='1710,0,1711' where sellbillid=294;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 4050, 4050, 4050
                    , 4050, 3726, 3726, 3726
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3726, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3726
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3726
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4050, 4050, 4050
                    , 4050, 3726, 3726, 3726
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3726, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3726
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3726
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, 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, 4050, 4050, 4050
                    , 4050, 3726, 3726, 3726, 4050, 4050)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+4050, netSellCostBuyPrice = netSellCostBuyPrice+4050
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+4050
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+4050
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3726
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3726
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3726
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+4050
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+4050;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:52:03";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:22:03", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:22:03', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5674
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:52:10";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:22:10", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:22:10', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=294'); -- id=5675
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:52:10";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:22:10", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:22:10', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=294'); -- id=5676
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:52:24";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:22:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 11:22:24', '1', 'showbarcodebuybill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=89&type=2'); -- id=5677
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:52:31";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:22:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 11:22:31', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=5678
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:52:33";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:22:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 11:22:33', '1', 'showbarcode', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=5679
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:55:40";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:25:40", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:25:40', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5680
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:55:40";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:25:40", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:25:40', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5681
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:57:41";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:27:41", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:27:41', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5682

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8a42baed67
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 11:27:41', '06ac8a42baed67', '1', '0.00', '0', '0', '1', '10350.00', '10350', '10350', '0', '2', '2026-10-09 11:27:41', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '26' ,'0','','','','','-1','0','0','0','0','0','10350','0','','0','0','10350','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=295
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','295', '0', '2026-10-09 11:27:41', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10350', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 11:27:41','0','0','',''); -- id=402
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+7 where id = 225;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('390','01444', '295', '88', '1444', '7', '420', '2940', '0', '', '0', '2026-10-09 11:27:41', '1444', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','225-7,','1','1','0','0','420','2940','0','','0','0.00','0','0','0','0'); -- id=1078
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 390.00
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 390
                where sellbilldetailid = 1078;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1444, '2026-10-09', 2940, 2730, 2730
                    , 2730, 2730, 2730, 2730
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 2730, 2730, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2940, sellCostBuyPrice =sellCostBuyPrice+2730
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2730, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2730
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2730, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2730
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2730
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2730
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2730
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+7
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-09', 2940, 2730, 2730
                    , 2730, 2730, 2730, 2730
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2730, 2730, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2940, sellCostBuyPrice =sellCostBuyPrice+2730
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2730, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2730
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2730, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2730
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2730
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2730
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2730
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '4', storedetaildate = '2026-10-09 11:27:41' WHERE storedetailid = '1475';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1444', '2', '7', '1', '295', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '8', '4', '2026-10-09 11:27:41','0','0'); -- id=3926
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 133;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01325', '295', '87', '1325', '3', '390', '1170', '0', '', '0', '2026-10-09 11:27:41', '1325', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','133-3,','1','1','0','0','390','1170','0','','0','0.00','0','0','0','0'); -- id=1079
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1079;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1325, '2026-10-09', 1170, 1050, 1050
                    , 1050, 1050, 1050, 1050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1050, 1050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1170, 1050, 1050
                    , 1050, 1050, 1050, 1050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1050, 1050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '232', userid = '4', storedetaildate = '2026-10-09 11:27:41' WHERE storedetailid = '1406';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1325', '2', '3', '1', '295', 'اضافة فاتورة مبيعات', 'sellbillController.php', '235', '232', '4', '2026-10-09 11:27:41','0','0'); -- id=3927
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+16 where id = 131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01324', '295', '86', '1324', '16', '390', '6240', '0', '', '0', '2026-10-09 11:27:41', '1324', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','131-16,','1','1','0','0','390','6240','0','','0','0.00','0','0','0','0'); -- id=1080
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1080;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1324, '2026-10-09', 6240, 5600, 5600
                    , 5600, 5600, 5600, 5600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 5600, 5600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6240, sellCostBuyPrice =sellCostBuyPrice+5600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-09', 6240, 5600, 5600
                    , 5600, 5600, 5600, 5600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5600, 5600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6240, sellCostBuyPrice =sellCostBuyPrice+5600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '696', userid = '4', storedetaildate = '2026-10-09 11:27:41' WHERE storedetailid = '1405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '2', '16', '1', '295', 'اضافة فاتورة مبيعات', 'sellbillController.php', '712', '696', '4', '2026-10-09 11:27:41','0','0'); -- id=3928
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '411660',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('401310','10350', '0', '3', 'اضافة فاتورة مبيعات', '295', '411660', '2026-10-09 11:27:41', '4',  'sellbillController.php','1','','0'); -- id=340
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10350', '10350', '2026-10-09', '4', '0', '0', '2026-10-09 11:27:41','اضافة فاتورة مبيعات رقم 295','1','0',null,'0','295','sellbillController.php?do=showDetail&sellbillid=295'); -- id=1712
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1712', '501', '10350', '','0'); -- id=1741
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '411660', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1712', '143', '10350', '','0'); -- id=1712
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3169295', 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 ( '9380', '9380', '2026-10-09', '4', '0', '0', '2026-10-09 11:27:41','اضافة فاتورة مبيعات رقم 295 - صرف البضاعة من المخزن','1','0',null,'0','295','sellbillController.php?do=showDetail&sellbillid=295'); -- id=1713
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1713', '402', '9380', '','0'); -- id=1742
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2981828.1', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1713', '492', '9380', '','0'); -- id=1713
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '758065', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1712,0,1713' where sellbillid=295;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 10350, 9380, 9380
                    , 9380, 9380, 9380, 9380
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9380, 9380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10350, sellCostBuyPrice =sellCostBuyPrice+9380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9380, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9380
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9380
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 10350, 9380, 9380
                    , 9380, 9380, 9380, 9380
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9380, 9380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10350, sellCostBuyPrice =sellCostBuyPrice+9380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9380, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9380
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9380
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9380
                        , returnSellVal = returnSellVal+0, 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, 10350, 9380, 9380
                    , 9380, 9380, 9380, 9380, 9380, 9380)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10350, netSellCostBuyPrice = netSellCostBuyPrice+9380
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+9380
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+9380
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+9380
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+9380
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+9380
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+9380
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+9380;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8a42baed67 and sellbillId = 295 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 07:57:42";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:27:42", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:27:42', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5683
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:02:28";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:32:28", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:32:28', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5684

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8a0ef9847a
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 11:32:28', '06ac8a0ef9847a', '1', '0.00', '0', '0', '1', '15285.00', '15285', '15285', '0', '1', '2026-10-09 11:32:28', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '39' ,'0','','','','','-1','0','0','0','0','0','15285','0','','0','0','15285','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=296
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','296', '0', '2026-10-09 11:32:28', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '15285', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 11:32:28','0','0','',''); -- id=403
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+21 where id = 425;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('372','01584', '296', '115', '1584', '21', '400', '8400', '0', '', '0', '2026-10-09 11:32:28', '1584', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','425-21,','1','1','0','0','400','8400','0','','0','0.00','0','0','0','0'); -- id=1081
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 372.00, meanbuyprice_withDiscount = 372.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 372
                where sellbilldetailid = 1081;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1584, '2026-10-09', 8400, 8400, 8400
                    , 8400, 7812, 7812, 7812
                    , 0, 0, 0, 0
                    , 0, 0, 0, 21, 0, 8400, 8400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8400, sellCostBuyPrice =sellCostBuyPrice+8400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7812, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7812
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7812
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+21
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 8400, 8400, 8400
                    , 8400, 7812, 7812, 7812
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8400, 8400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8400, sellCostBuyPrice =sellCostBuyPrice+8400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7812, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7812
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7812
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '2', storedetaildate = '2026-10-09 11:32:28' WHERE storedetailid = '1609';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1584', '1', '21', '1', '296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '51', '30', '2', '2026-10-09 11:32:28','0','0'); -- id=3929
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 426;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('418.5','01585', '296', '115', '1585', '9', '450', '4050', '0', '', '0', '2026-10-09 11:32:28', '1585', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','426-9,','1','1','0','0','450','4050','0','','0','0.00','0','0','0','0'); -- id=1082
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 418.50, meanbuyprice_withDiscount = 418.50
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 418.5
                where sellbilldetailid = 1082;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1585, '2026-10-09', 4050, 4050, 4050
                    , 4050, 3766.5, 3766.5, 3766.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3766.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3766.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3766.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4050, 4050, 4050
                    , 4050, 3766.5, 3766.5, 3766.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3766.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3766.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3766.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 11:32:28' WHERE storedetailid = '1610';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1585', '1', '9', '1', '296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '3', '2', '2026-10-09 11:32:28','0','0'); -- id=3930
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 428;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('292.95','01587', '296', '115', '1587', '9', '315', '2835', '0', '', '0', '2026-10-09 11:32:28', '1587', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','428-9,','1','1','0','0','315','2835','0','','0','0.00','0','0','0','0'); -- id=1083
UPDATE sellbilldetail SET  lastbuyprice = 315.00 , meanbuyprice = 315.00, lastbuyprice_withDiscount = 292.95, meanbuyprice_withDiscount = 292.95
        , lastbuyprice_withTax = 315, meanbuyprice_withTax = 315, lastbuyprice_withDiscountAndTax = 292.95
                where sellbilldetailid = 1083;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1587, '2026-10-09', 2835, 2835, 2835
                    , 2835, 2636.55, 2636.55, 2636.55
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2835, 2835, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2835, sellCostBuyPrice =sellCostBuyPrice+2835
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2835, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2835
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2636.55, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2636.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2636.55
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2835
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2835
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2835, 2835, 2835
                    , 2835, 2636.55, 2636.55, 2636.55
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2835, 2835, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2835, sellCostBuyPrice =sellCostBuyPrice+2835
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2835, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2835
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2636.55, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2636.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2636.55
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2835
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2835
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 11:32:28' WHERE storedetailid = '1612';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1587', '1', '9', '1', '296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '3', '2', '2026-10-09 11:32:28','0','0'); -- id=3931
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1716490',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1701205','15285', '0', '2', 'اضافة فاتورة مبيعات', '296', '1716490', '2026-10-09 11:32:28', '2',  'sellbillController.php','1','','0'); -- id=341
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '15285', '15285', '2026-10-09', '2', '0', '0', '2026-10-09 11:32:28','اضافة فاتورة مبيعات رقم 296','1','0',null,'0','296','sellbillController.php?do=showDetail&sellbillid=296'); -- id=1714
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1714', '419', '15285', '','0'); -- id=1743
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1716490', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1714', '143', '15285', '','0'); -- id=1714
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3184580', 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 ( '14215.05', '14215.05', '2026-10-09', '2', '0', '0', '2026-10-09 11:32:28','اضافة فاتورة مبيعات رقم 296 - صرف البضاعة من المخزن','1','0',null,'0','296','sellbillController.php?do=showDetail&sellbillid=296'); -- id=1715
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1715', '402', '14215.05', '','0'); -- id=1744
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '2996043.15', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1715', '382', '14215.05', '','0'); -- id=1715
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20013875.05', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1714,0,1715' where sellbillid=296;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 15285, 15285, 15285
                    , 15285, 14215.05, 14215.05, 14215.05
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15285, 15285, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15285, sellCostBuyPrice =sellCostBuyPrice+15285
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15285, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15285
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14215.05, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14215.05
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14215.05
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15285
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15285
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 15285, 15285, 15285
                    , 15285, 14215.05, 14215.05, 14215.05
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15285, 15285, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15285, sellCostBuyPrice =sellCostBuyPrice+15285
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15285, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15285
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14215.05, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14215.05
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14215.05
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15285
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15285
                        , returnSellVal = returnSellVal+0, 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, 15285, 15285, 15285
                    , 15285, 14215.05, 14215.05, 14215.05, 15285, 15285)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+15285, netSellCostBuyPrice = netSellCostBuyPrice+15285
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+15285
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+15285
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+14215.05
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+14215.05
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+14215.05
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+15285
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+15285;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:02:29";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:32:29", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:32:29', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5685
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:03:13";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:33:13", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:33:13', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5686

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8a5049e03b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 11:33:13', '06ac8a5049e03b', '1', '0.00', '0', '0', '1', '7600.00', '7600', '7600', '0', '1', '2026-10-09 11:33:13', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '14' ,'0','','','','','-1','0','0','0','0','0','7600','0','','0','0','7600','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=297
UPDATE client SET  clientdebt = '0', userid = '3' 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','اضافة فاتورة مبيعات','297', '0', '2026-10-09 11:33:13', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '7600', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 11:33:13','0','0','',''); -- id=404
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 251;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('550','01488', '297', '107', '1488', '8', '590', '4720', '0', '', '0', '2026-10-09 11:33:13', '1488', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','251-8,','1','1','0','0','590','4720','0','','0','0.00','0','0','0','0'); -- id=1084
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 550.00, meanbuyprice_withDiscount = 550.00
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 550
                where sellbilldetailid = 1084;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1488, '2026-10-09', 4720, 4400, 4400
                    , 4400, 4400, 4400, 4400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 4400, 4400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4720, sellCostBuyPrice =sellCostBuyPrice+4400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4720, 4400, 4400
                    , 4400, 4400, 4400, 4400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4400, 4400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4720, sellCostBuyPrice =sellCostBuyPrice+4400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '3', storedetaildate = '2026-10-09 11:33:13' WHERE storedetailid = '1513';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1488', '1', '8', '1', '297', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16', '8', '3', '2026-10-09 11:33:13','0','0'); -- id=3932
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 514;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('441.6','01665', '297', '124', '1665', '6', '480', '2880', '0', '', '0', '2026-10-09 11:33:13', '1665', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','514-6,','1','1','0','0','480','2880','0','','0','0.00','0','0','0','0'); -- id=1085
UPDATE sellbilldetail SET  lastbuyprice = 480.00 , meanbuyprice = 480.00, lastbuyprice_withDiscount = 441.60, meanbuyprice_withDiscount = 441.60
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 480, lastbuyprice_withDiscountAndTax = 441.6
                where sellbilldetailid = 1085;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1665, '2026-10-09', 2880, 2880, 2880
                    , 2880, 2649.6, 2649.6, 2649.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2649.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2649.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2649.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2880, 2880, 2880
                    , 2880, 2649.6, 2649.6, 2649.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2649.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2649.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2649.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '3', storedetaildate = '2026-10-09 11:33:13' WHERE storedetailid = '2677';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1665', '1', '6', '1', '297', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '21', '3', '2026-10-09 11:33:13','0','0'); -- id=3933
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1724090',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1716490','7600', '0', '2', 'اضافة فاتورة مبيعات', '297', '1724090', '2026-10-09 11:33:13', '3',  'sellbillController.php','1','','0'); -- id=342
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7600', '7600', '2026-10-09', '3', '0', '0', '2026-10-09 11:33:13','اضافة فاتورة مبيعات رقم 297','1','0',null,'0','297','sellbillController.php?do=showDetail&sellbillid=297'); -- id=1716
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1716', '419', '7600', '','0'); -- id=1745
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1724090', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1716', '143', '7600', '','0'); -- id=1716
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3192180', 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 ( '7049.6', '7049.6', '2026-10-09', '3', '0', '0', '2026-10-09 11:33:13','اضافة فاتورة مبيعات رقم 297 - صرف البضاعة من المخزن','1','0',null,'0','297','sellbillController.php?do=showDetail&sellbillid=297'); -- id=1717
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1717', '402', '7049.6', '','0'); -- id=1746
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3003092.75', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1717', '382', '7049.6', '','0'); -- id=1717
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20006825.45', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1716,0,1717' where sellbillid=297;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 7600, 7280, 7280
                    , 7280, 7049.6, 7049.6, 7049.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7280, 7280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7600, sellCostBuyPrice =sellCostBuyPrice+7280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7049.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7049.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7049.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 7600, 7280, 7280
                    , 7280, 7049.6, 7049.6, 7049.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7280, 7280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7600, sellCostBuyPrice =sellCostBuyPrice+7280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7049.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7049.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7049.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7280
                        , returnSellVal = returnSellVal+0, 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, 7600, 7280, 7280
                    , 7280, 7049.6, 7049.6, 7049.6, 7280, 7280)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+7600, netSellCostBuyPrice = netSellCostBuyPrice+7280
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+7280
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+7280
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+7049.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+7049.6
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+7049.6
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+7280
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+7280;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8a5049e03b and sellbillId = 297 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:03:13";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:33:13", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:33:13', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5687
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:03:16";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:33:16", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:33:16', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=297'); -- id=5688
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:03:39";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:33:39", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:33:39', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5689
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:03:39";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:33:39", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:33:39', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5690
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:05:18";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:35:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 11:35:18', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=5691
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:05:20";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:35:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 11:35:20', '1', 'showbarcode', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=5692
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:08:39";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:38:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 11:38:39', '1', 'showbarcode', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=5693
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:11:06";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:41:06", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:41:06', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=297'); -- id=5694
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:11:06";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:41:06", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:41:06', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=297'); -- id=5695
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:11:17";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:41:17", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:41:17', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5696
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:11:17";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:41:17", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:41:17', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5697
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:11:24";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:41:24", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:41:24', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5698

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8a8adeb5db
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 11:41:24', '06ac8a8adeb5db', '1', '0.00', '0', '0', '1', '330.00', '330', '330', '0', '1', '2026-10-09 11:41:24', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','330','0','','0','0','330','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=298
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','298', '0', '2026-10-09 11:41:24', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '330', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 11:41:24','0','0','',''); -- id=405
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 75;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','01383', '298', '94', '1383', '1', '330', '330', '0', '', '0', '2026-10-09 11:41:24', '1383', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','75-1,','1','1','0','0','330','330','0','','0','0.00','0','0','0','0'); -- id=1086
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 1086;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1383, '2026-10-09', 330, 300, 300
                    , 300, 300, 300, 300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 300, 300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+330, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 330, 300, 300
                    , 300, 300, 300, 300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 300, 300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+330, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '374', userid = '3', storedetaildate = '2026-10-09 11:41:24' WHERE storedetailid = '1383';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1383', '1', '1', '1', '298', 'اضافة فاتورة مبيعات', 'sellbillController.php', '375', '374', '3', '2026-10-09 11:41:24','0','0'); -- id=3934
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1724420',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1724090','330', '0', '2', 'اضافة فاتورة مبيعات', '298', '1724420', '2026-10-09 11:41:24', '3',  'sellbillController.php','1','','0'); -- id=343
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '330', '330', '2026-10-09', '3', '0', '0', '2026-10-09 11:41:24','اضافة فاتورة مبيعات رقم 298','1','0',null,'0','298','sellbillController.php?do=showDetail&sellbillid=298'); -- id=1718
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1718', '419', '330', '','0'); -- id=1747
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1724420', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1718', '143', '330', '','0'); -- id=1718
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3192510', 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 ( '300', '300', '2026-10-09', '3', '0', '0', '2026-10-09 11:41:24','اضافة فاتورة مبيعات رقم 298 - صرف البضاعة من المخزن','1','0',null,'0','298','sellbillController.php?do=showDetail&sellbillid=298'); -- id=1719
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1719', '402', '300', '','0'); -- id=1748
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3003392.75', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1719', '382', '300', '','0'); -- id=1719
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20006525.45', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1718,0,1719' where sellbillid=298;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 330, 300, 300
                    , 300, 300, 300, 300
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,300, 300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+330, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 330, 300, 300
                    , 300, 300, 300, 300
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,300, 300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+330, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+300
                        , returnSellVal = returnSellVal+0, 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, 330, 300, 300
                    , 300, 300, 300, 300, 300, 300)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+330, netSellCostBuyPrice = netSellCostBuyPrice+300
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+300
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+300
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+300
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+300
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+300
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+300
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+300;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:11:24";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:41:24", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:41:24', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5699
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:11:29";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:41:29", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:41:29', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=298'); -- id=5700
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:11:29";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:41:29", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:41:29', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=298'); -- id=5701
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:12:14";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:42:14", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:42:14', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=5702
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:12:14";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:42:14", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:42:14', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=5703
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:12:30";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:42:30", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:42:30', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5704
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:12:30";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:42:30", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:42:30', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5705
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:21:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:51:32", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:51:32', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5706

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8a8f6a57ae
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 11:51:32', '06ac8a8f6a57ae', '1', '0.00', '0', '0', '1', '5940.00', '5940', '5940', '0', '1', '2026-10-09 11:51:32', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '15' ,'0','','','','','-1','0','0','0','0','0','5940','0','','0','0','5940','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=299
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','299', '0', '2026-10-09 11:51:32', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '5940', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 11:51:32','0','0','',''); -- id=406
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 329;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','01459', '299', '103', '1459', '3', '330', '990', '0', '', '0', '2026-10-09 11:51:32', '1459', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','329-3,','1','1','0','0','330','990','0','','0','0.00','0','0','0','0'); -- id=1087
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 1087;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1459, '2026-10-09', 990, 930, 930
                    , 930, 930, 930, 930
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 930, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+990, sellCostBuyPrice =sellCostBuyPrice+930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+930
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+930
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 990, 930, 930
                    , 930, 930, 930, 930
                    , 0, 0, 0, 0
                    , 0, 0, 0, 930, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+990, sellCostBuyPrice =sellCostBuyPrice+930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+930
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+930
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 11:51:32' WHERE storedetailid = '1484';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1459', '1', '3', '1', '299', 'اضافة فاتورة مبيعات', 'sellbillController.php', '37', '34', '3', '2026-10-09 11:51:32','0','0'); -- id=3935
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 426;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('418.5','01585', '299', '115', '1585', '3', '450', '1350', '0', '', '0', '2026-10-09 11:51:32', '1585', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','426-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=1088
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 418.50, meanbuyprice_withDiscount = 418.50
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 418.5
                where sellbilldetailid = 1088;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1585, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1255.5, 1255.5, 1255.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1255.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1255.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1255.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1255.5, 1255.5, 1255.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1255.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1255.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1255.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 11:51:32' WHERE storedetailid = '1610';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1585', '1', '3', '1', '299', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '0', '3', '2026-10-09 11:51:32','0','0'); -- id=3936
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 425;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('372','01584', '299', '115', '1584', '9', '400', '3600', '0', '', '0', '2026-10-09 11:51:32', '1584', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','425-9,','1','1','0','0','400','3600','0','','0','0.00','0','0','0','0'); -- id=1089
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 372.00, meanbuyprice_withDiscount = 372.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 372
                where sellbilldetailid = 1089;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1584, '2026-10-09', 3600, 3600, 3600
                    , 3600, 3348, 3348, 3348
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3348, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3348
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3348
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3600, 3600, 3600
                    , 3600, 3348, 3348, 3348
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3348, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3348
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3348
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '3', storedetaildate = '2026-10-09 11:51:32' WHERE storedetailid = '1609';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1584', '1', '9', '1', '299', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '21', '3', '2026-10-09 11:51:32','0','0'); -- id=3937
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1730360',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1724420','5940', '0', '2', 'اضافة فاتورة مبيعات', '299', '1730360', '2026-10-09 11:51:32', '3',  'sellbillController.php','1','','0'); -- id=344
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5940', '5940', '2026-10-09', '3', '0', '0', '2026-10-09 11:51:32','اضافة فاتورة مبيعات رقم 299','1','0',null,'0','299','sellbillController.php?do=showDetail&sellbillid=299'); -- id=1720
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1720', '419', '5940', '','0'); -- id=1749
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1730360', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1720', '143', '5940', '','0'); -- id=1720
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3198450', 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 ( '5533.5', '5533.5', '2026-10-09', '3', '0', '0', '2026-10-09 11:51:32','اضافة فاتورة مبيعات رقم 299 - صرف البضاعة من المخزن','1','0',null,'0','299','sellbillController.php?do=showDetail&sellbillid=299'); -- id=1721
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1721', '402', '5533.5', '','0'); -- id=1750
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3008926.25', 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 ('1721', '382', '5533.5', '','0'); -- id=1721
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20000991.95', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1720,0,1721' where sellbillid=299;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 5940, 5880, 5880
                    , 5880, 5533.5, 5533.5, 5533.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5880, 5880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5940, sellCostBuyPrice =sellCostBuyPrice+5880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5533.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5533.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5533.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5940, 5880, 5880
                    , 5880, 5533.5, 5533.5, 5533.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5880, 5880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5940, sellCostBuyPrice =sellCostBuyPrice+5880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5533.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5533.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5533.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5880
                        , returnSellVal = returnSellVal+0, 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, 5940, 5880, 5880
                    , 5880, 5533.5, 5533.5, 5533.5, 5880, 5880)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5940, netSellCostBuyPrice = netSellCostBuyPrice+5880
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5880
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5880
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5533.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5533.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5533.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5880
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5880;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:21:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:51:32", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:51:32', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5707
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:21:34";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:51:34", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:51:34', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=299'); -- id=5708
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:21:35";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:51:35", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:51:35', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=299'); -- id=5709
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:21:50";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:51:50", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:51:50', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5710
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:22:07";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:52:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 11:52:07', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5711
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:22:07";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 11:52:07', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5712
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:22:16";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:52:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnBuyBillController.php', '2026-10-09 11:52:16', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/returnBuyBillController.php?do=show'); -- id=5713
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:22:22";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:52:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 11:52:22', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=5714
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:22:27";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:52:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 11:52:27', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=5715
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:22:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:52:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 11:52:32', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=5716
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:22:38";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:52:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 11:52:38', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=5717
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:22:48";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:52:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 11:52:48', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=5718
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:23:14";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:53:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userController.php', '2026-10-09 11:53:14', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/userController.php?do=show'); -- id=5719
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:23:26";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:53:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userController.php', '2026-10-09 11:53:26', '1', 'edit', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/userController.php?do=edit&userid=5'); -- id=5720
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:24:02";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:54:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userController.php', '2026-10-09 11:54:02', '1', 'update', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/userController.php?do=update'); -- id=5721
UPDATE user SET username = 'هبه', password = '123', usergroupid = '1', employeename = 'هبه', currentdate = '2026-10-01', conditions = '0', saveid = '1'  , userstoreid ='0' ,awardrate = '0' ,searchinonesave = '0', branchId = '-1', question = 'ما اسمك', answer = 'هبه',blockedByLimits = '0',directSaveBills = '0',userstoreidDef='1',empid='0',obygyDoctorId = '0',lang = '',viewclients = '1',viewbills = '1',storeSupervisor='1',storeSupervisorStores='1',projectids='0',bankids='0',saveids='-1,1,3,4',searchinonestorebalance='0',storeids='0',webApiId='0',closeSavid='1',charityids='0',laterNakdiUserIds='-1,-1',awardrategomla = '0',awardratehalf = '0', dellaternakdipayed='0',accountids='-1,' WHERE userid = '5';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:24:02";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:54:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userController.php', '2026-10-09 11:54:02', '1', 'sucess', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/userController.php?do=sucess'); -- id=5722
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:24:04";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:54:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userController.php', '2026-10-09 11:54:04', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/userController.php?do=show'); -- id=5723
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:24:10";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:54:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userController.php', '2026-10-09 11:54:10', '1', 'edit', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/userController.php?do=edit&userid=3'); -- id=5724
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:24:57";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:54:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userController.php', '2026-10-09 11:54:57', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/userController.php?do=show'); -- id=5725
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:25:00";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:55:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userController.php', '2026-10-09 11:55:00', '1', 'edit', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/userController.php?do=edit&userid=3'); -- id=5726
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:25:33";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:55:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userController.php', '2026-10-09 11:55:33', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/userController.php?do=show'); -- id=5727
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:25:37";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:55:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userController.php', '2026-10-09 11:55:37', '1', 'edit', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/userController.php?do=edit&userid=2'); -- id=5728
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:26:10";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:56:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userController.php', '2026-10-09 11:56:10', '1', 'update', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/userController.php?do=update'); -- id=5729
UPDATE user SET username = 'كاشير', password = '123', usergroupid = '3', employeename = 'ياسمين', currentdate = '2026-09-27', conditions = '0', saveid = '2'  , userstoreid ='-1' ,awardrate = '0' ,searchinonesave = '0', branchId = '-1', question = 'اسمك ايه', answer = 'اشرب شاي',blockedByLimits = '0',directSaveBills = '0',userstoreidDef='1',empid='0',obygyDoctorId = '0',lang = '',viewclients = '1',viewbills = '0',storeSupervisor='0',storeSupervisorStores='',projectids='0',bankids='0',saveids='-1,2',searchinonestorebalance='0',storeids='1',webApiId='0',closeSavid='2',charityids='0',laterNakdiUserIds='-1,-1',awardrategomla = '0',awardratehalf = '0', dellaternakdipayed='1',accountids='-1,' WHERE userid = '2';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:26:11";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:56:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userController.php', '2026-10-09 11:56:11', '1', 'sucess', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/userController.php?do=sucess'); -- id=5730
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:26:12";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:56:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userController.php', '2026-10-09 11:56:12', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/userController.php?do=show'); -- id=5731
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:26:14";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:56:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:56:14', '1', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5732
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:26:20";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:56:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-09 11:56:20', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=5733
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:26:24";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:56:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-09 11:56:24', '1', 'edit', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=edit&id=5'); -- id=5734
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:26:39";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:56:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:56:39', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=5735
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:26:46";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:56:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:56:46', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=5736
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:26:49";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:56:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:56:49', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=5737
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:27:14";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:57:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:57:14', '1', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=298'); -- id=5738
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:27:22";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:57:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:57:22', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=5739
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:27:42";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:57:42", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:57:42', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5740

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8a69d27344
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 11:57:42', '06ac8a69d27344', '1', '0.00', '0', '0', '1', '8775.00', '8775', '8775', '0', '1', '2026-10-09 11:57:42', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '21' ,'0','','','','','-1','0','0','0','0','0','8775','0','','0','0','8775','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=300
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','300', '0', '2026-10-09 11:57:42', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '8775', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 11:57:42','0','0','',''); -- id=407
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 74;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','01382', '300', '94', '1382', '3', '400', '1200', '0', '', '0', '2026-10-09 11:57:42', '1382', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','74-3,','1','1','0','0','400','1200','0','','0','0.00','0','0','0','0'); -- id=1090
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1090;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1382, '2026-10-09', 1200, 1080, 1080
                    , 1080, 1080, 1080, 1080
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1200, 1080, 1080
                    , 1080, 1080, 1080, 1080
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 11:57:42' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '3', '1', '300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '114', '111', '2', '2026-10-09 11:57:42','0','0'); -- id=3938
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 571;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('432.4','01708', '300', '128', '1708', '3', '470', '1410', '0', '', '0', '2026-10-09 11:57:42', '1708', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','571-3,','1','1','0','0','470','1410','0','','0','0.00','0','0','0','0'); -- id=1091
UPDATE sellbilldetail SET  lastbuyprice = 470.00 , meanbuyprice = 470.00, lastbuyprice_withDiscount = 432.40, meanbuyprice_withDiscount = 451.20
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 235, lastbuyprice_withDiscountAndTax = 432.4
                where sellbilldetailid = 1091;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1708, '2026-10-09', 1410, 1410, 1410
                    , 1410, 1297.2, 1353.6, 1297.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1410, 705, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1297.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1353.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1297.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1410
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+705
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1410, 1410, 1410
                    , 1410, 1297.2, 1353.6, 1297.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1410, 705, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1297.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1353.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1297.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1410
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+705
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '2', storedetaildate = '2026-10-09 11:57:42' WHERE storedetailid = '2720';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1708', '1', '3', '1', '300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '21', '2', '2026-10-09 11:57:42','0','0'); -- id=3939
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 568;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('427.8','01705', '300', '128', '1705', '3', '465', '1395', '0', '', '0', '2026-10-09 11:57:42', '1705', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','568-3,','1','1','0','0','465','1395','0','','0','0.00','0','0','0','0'); -- id=1092
UPDATE sellbilldetail SET  lastbuyprice = 465.00 , meanbuyprice = 465.00, lastbuyprice_withDiscount = 427.80, meanbuyprice_withDiscount = 446.40
        , lastbuyprice_withTax = 465, meanbuyprice_withTax = 232.5, lastbuyprice_withDiscountAndTax = 427.8
                where sellbilldetailid = 1092;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1705, '2026-10-09', 1395, 1395, 1395
                    , 1395, 1283.4, 1339.2, 1283.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1395, 697.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1395, sellCostBuyPrice =sellCostBuyPrice+1395
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1395, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1395
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1283.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1339.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1283.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1395
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+697.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+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1395, 1395, 1395
                    , 1395, 1283.4, 1339.2, 1283.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1395, 697.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1395, sellCostBuyPrice =sellCostBuyPrice+1395
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1395, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1395
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1283.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1339.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1283.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1395
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+697.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 = '24', userid = '2', storedetaildate = '2026-10-09 11:57:42' WHERE storedetailid = '2717';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1705', '1', '3', '1', '300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '24', '2', '2026-10-09 11:57:42','0','0'); -- id=3940
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 235;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01456', '300', '94', '1456', '3', '360', '1080', '0', '', '0', '2026-10-09 11:57:42', '1456', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','235-3,','1','1','0','0','360','1080','0','','0','0.00','0','0','0','0'); -- id=1093
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 1093;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1456, '2026-10-09', 1080, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1080, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '207', userid = '2', storedetaildate = '2026-10-09 11:57:42' WHERE storedetailid = '1481';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1456', '1', '3', '1', '300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '210', '207', '2', '2026-10-09 11:57:42','0','0'); -- id=3941
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 505;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('362.7','01659', '300', '125', '1659', '3', '390', '1170', '0', '', '0', '2026-10-09 11:57:42', '1659', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','505-3,','1','1','0','0','390','1170','0','','0','0.00','0','0','0','0'); -- id=1094
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 362.70, meanbuyprice_withDiscount = 362.70
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 362.7
                where sellbilldetailid = 1094;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1659, '2026-10-09', 1170, 1170, 1170
                    , 1170, 1088.1, 1088.1, 1088.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1088.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1088.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1088.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1170
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1170, 1170, 1170
                    , 1170, 1088.1, 1088.1, 1088.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1088.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1088.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1088.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1170
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '201', userid = '2', storedetaildate = '2026-10-09 11:57:42' WHERE storedetailid = '2671';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1659', '1', '3', '1', '300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '204', '201', '2', '2026-10-09 11:57:42','0','0'); -- id=3942
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 275;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('378','01469', '300', '105', '1469', '6', '420', '2520', '0', '', '0', '2026-10-09 11:57:42', '1469', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','275-6,','1','1','0','0','420','2520','0','','0','0.00','0','0','0','0'); -- id=1095
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 420.00, lastbuyprice_withDiscount = 378.00, meanbuyprice_withDiscount = 378.00
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 378
                where sellbilldetailid = 1095;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1469, '2026-10-09', 2520, 2520, 2520
                    , 2520, 2268, 2268, 2268
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2520, 2520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2268, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2268
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2268
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2520, 2520, 2520
                    , 2520, 2268, 2268, 2268
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2520, 2520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2268, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2268
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2268
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '102', userid = '2', storedetaildate = '2026-10-09 11:57:42' WHERE storedetailid = '1494';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1469', '1', '6', '1', '300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '108', '102', '2', '2026-10-09 11:57:42','0','0'); -- id=3943
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1739135',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1730360','8775', '0', '2', 'اضافة فاتورة مبيعات', '300', '1739135', '2026-10-09 11:57:42', '2',  'sellbillController.php','1','','0'); -- id=345
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '8775', '8775', '2026-10-09', '2', '0', '0', '2026-10-09 11:57:42','اضافة فاتورة مبيعات رقم 300','1','0',null,'0','300','sellbillController.php?do=showDetail&sellbillid=300'); -- id=1722
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1722', '419', '8775', '','0'); -- id=1751
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1739135', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1722', '143', '8775', '','0'); -- id=1722
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3207225', 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 ( '7976.7', '7976.7', '2026-10-09', '2', '0', '0', '2026-10-09 11:57:42','اضافة فاتورة مبيعات رقم 300 - صرف البضاعة من المخزن','1','0',null,'0','300','sellbillController.php?do=showDetail&sellbillid=300'); -- id=1723
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1723', '402', '7976.7', '','0'); -- id=1752
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3016902.95', 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 ('1723', '382', '7976.7', '','0'); -- id=1723
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19993015.25', 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='1722,0,1723' where sellbillid=300;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 8775, 8535, 8535
                    , 8535, 7976.7, 8088.9, 7976.7
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8535, 7132.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8775, sellCostBuyPrice =sellCostBuyPrice+8535
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8535, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8535
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7976.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8088.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7976.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8535
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7132.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-10-09', 8775, 8535, 8535
                    , 8535, 7976.7, 8088.9, 7976.7
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8535, 7132.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8775, sellCostBuyPrice =sellCostBuyPrice+8535
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8535, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8535
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7976.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8088.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7976.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8535
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7132.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, 8775, 8535, 8535
                    , 8535, 7976.7, 8088.9, 7976.7, 8535, 7132.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+8775, netSellCostBuyPrice = netSellCostBuyPrice+8535
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+8535
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+8535
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+7976.7
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+8088.9
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+7976.7
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+8535
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+7132.5;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:27:42";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:57:42", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:57:42', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5741
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:27:46";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:57:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:57:46', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=5742
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:27:49";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:57:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:57:49', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=5743
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:27:51";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:57:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:57:51', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=5744
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:28:10";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:58:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:58:10', '1', 'delete', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=delete&sellbillid=298'); -- id=5745

-- ----------------------------------------------------------------------------------------------------
-- bill delete start - sellbill with id = 298
-- ----------------------------------------------------------------------------------------------------

BEGIN;
UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 298;
UPDATE dailyentry SET totalcreditor = '330.00', totaldebtor = '330.00', thedate = '2026-10-09', userid = '3', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 11:41:24', entryComment = 'اضافة فاتورة مبيعات رقم 298', fromFlag = '1',related='0',isopeningentry='0',operationId='298',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=298' WHERE id = '1718';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '330.00', '330.00', '2026-10-09', '1', '0', '1718', '2026-10-09 11:58:10','تم عكس القيد رقم 1718 ','1','0','-1','0','0',''); -- id=1724
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1724', '419', '330.00', '','0'); -- id=1724
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1738805', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1724', '143', '330.00', '','0'); -- id=1753
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3206895', 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 = '300.00', totaldebtor = '300.00', thedate = '2026-10-09', userid = '3', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 11:41:24', entryComment = 'اضافة فاتورة مبيعات رقم 298 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='298',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=298' WHERE id = '1719';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '300.00', '300.00', '2026-10-09', '1', '0', '1719', '2026-10-09 11:58:10','تم عكس القيد رقم 1719 ','1','0','-1','0','0',''); -- id=1725
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1725', '402', '300.00', '','0'); -- id=1725
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3016602.95', 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 ('1725', '382', '300.00', '','0'); -- id=1754
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19993315.25', 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  sellbillsysdate = '2026-10-09 11:58:10', userid = '3',delbyuserid = '1', conditions = '1'  ,billReservation= 0,billReservationDate='0000-00-00'  WHERE sellbillid = '298';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 75;
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 1086;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1383, '2026-10-09', 330, 300, 300
                    , 300, 300, 300, 300
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 300, 300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-330, sellCostBuyPrice =sellCostBuyPrice-300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-300, sellCostMeanBuyPrice = sellCostMeanBuyPrice-300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-300
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 330, 300, 300
                    , 300, 300, 300, 300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 300, 300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-330, sellCostBuyPrice =sellCostBuyPrice-300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-300, sellCostMeanBuyPrice = sellCostMeanBuyPrice-300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-300
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '375', userid = '1', storedetaildate = '2026-10-09 11:58:10' WHERE storedetailid = '1383';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1383', '1', '1', '0', '298', 'حذف فاتورة مبيعات', 'sellbillController.php', '374', '375', '1', '2026-10-09 11:58:10','0','0'); -- id=3944
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0.00','1','حذف فاتورة مبيعات','298', '0', '2026-10-09 11:58:10', '1', 'sellbillController.php', 'حذف فاتورة مبيعات', '330', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 11:41:24','0','0','',''); -- id=408
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1738805',  userid = '1' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1739135','330', '1', '2', 'حذف فاتورة مبيعات', '298', '1738805', '2026-10-09 11:58:10', '1',  'sellbillController.php','1','','0'); -- id=346
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 330, 300, 300
                    , 300, 300, 300, 300
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,300, 300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-330, sellCostBuyPrice =sellCostBuyPrice-300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-300, sellCostMeanBuyPrice = sellCostMeanBuyPrice-300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-300
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 330, 300, 300
                    , 300, 300, 300, 300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 300, 300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-330, sellCostBuyPrice =sellCostBuyPrice-300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-300, sellCostMeanBuyPrice = sellCostMeanBuyPrice-300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-300
                        , returnSellVal = returnSellVal-0, 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, 330, 300, 300
                    , 300, 300, 300, 300, 300, 300)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-330, netSellCostBuyPrice = netSellCostBuyPrice-300
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-300
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-300
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-300
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-300
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-300
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-300
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-300;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill delete end - sellbill with id = 298
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:28:23";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:58:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:58:23', '1', 'delete', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=delete&sellbillid=298'); -- id=5746

-- ----------------------------------------------------------------------------------------------------
-- bill delete start - sellbill with id = 298
-- ----------------------------------------------------------------------------------------------------

BEGIN;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill delete end - sellbill with id = 298
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:28:25";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:58:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:58:25', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=5747
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:28:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:58:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:58:32', '1', 'delete', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=delete&sellbillid=298'); -- id=5748

-- ----------------------------------------------------------------------------------------------------
-- bill delete start - sellbill with id = 298
-- ----------------------------------------------------------------------------------------------------

BEGIN;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill delete end - sellbill with id = 298
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:28:34";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:58:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:58:34', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=5749
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:28:42";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:58:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:58:42', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=5750
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:28:49";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:58:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 11:58:49', '1', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=298'); -- id=5751
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:29:04";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:59:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-09 11:59:04', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=5752
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:29:09";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 11:59:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-09 11:59:09', '1', 'edit', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=edit&id=3'); -- id=5753
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:30:14";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:00:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-09 12:00:14', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=5754
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:30:22";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:00:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:00:22', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=5755
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:30:30";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:00:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:00:30', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=5756
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:30:39";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:00:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:00:39', '1', 'delete', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=delete&sellbillid=298'); -- id=5757

-- ----------------------------------------------------------------------------------------------------
-- bill delete start - sellbill with id = 298
-- ----------------------------------------------------------------------------------------------------

BEGIN;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill delete end - sellbill with id = 298
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:30:41";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:00:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:00:41', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=5758
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:30:56";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:00:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:00:56', '1', 'delete', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=delete&sellbillid=298'); -- id=5759

-- ----------------------------------------------------------------------------------------------------
-- bill delete start - sellbill with id = 298
-- ----------------------------------------------------------------------------------------------------

BEGIN;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill delete end - sellbill with id = 298
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:30:58";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:00:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:00:58', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=5760
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:31:04";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:01:04", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:01:04', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5761
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:32:24";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('dailyentry.php', '2026-10-09 12:02:24', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/dailyentry.php?id=1718,0,1719'); -- id=5762
BEGIN;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:32:25";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:02:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 12:02:25', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5763
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:32:26";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 12:02:26', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5764
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:32:41";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:02:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:02:41', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=5765
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:32:45";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:02:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:02:45', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=5766
UPDATE user SET loginip = "" WHERE userid = 6;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:34:03";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:04:03", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:04:03', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5767

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8ad501a7f9
-- ----------------------------------------------------------------------------------------------------

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

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:34:03";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:04:03", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:04:03', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5768
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:36:51";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:37:06";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:07:06", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 12:07:06', '6', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5769
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:37:06";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 12:07:06", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 12:07:06', '6', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5770
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:37:08";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:07:08", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:07:08', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5771
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:37:12";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:07:12", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:07:12', '6', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=284'); -- id=5772
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:37:18";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:07:18", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 12:07:18', '6', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5773
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:37:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:07:32", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:07:32', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5774

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8a57e1fd3e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 12:07:32', '06ac8a57e1fd3e', '1', '0.00', '0', '0', '1', '2690.00', '2690', '2690', '0', '2', '2026-10-09 12:07:32', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '7' ,'0','','','','','-1','0','0','0','0','0','2690','0','','0','0','2690','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=302
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','302', '0', '2026-10-09 12:07:32', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2690', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 12:07:32','0','0','',''); -- id=410
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 133;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01325', '302', '87', '1325', '3', '390', '1170', '0', '', '0', '2026-10-09 12:07:32', '1325', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','133-3,','1','1','0','0','390','1170','0','','0','0.00','0','0','0','0'); -- id=1097
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1097;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1325, '2026-10-09', 1170, 1050, 1050
                    , 1050, 1050, 1050, 1050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1050, 1050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1170, 1050, 1050
                    , 1050, 1050, 1050, 1050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1050, 1050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '229', userid = '4', storedetaildate = '2026-10-09 12:07:32' WHERE storedetailid = '1406';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1325', '2', '3', '1', '302', 'اضافة فاتورة مبيعات', 'sellbillController.php', '232', '229', '4', '2026-10-09 12:07:32','0','0'); -- id=3946
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 495;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01551', '302', '112', '1551', '4', '380', '1520', '0', '', '0', '2026-10-09 12:07:32', '1551', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','495-4,','1','1','0','0','380','1520','0','','0','0.00','0','0','0','0'); -- id=1098
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 1098;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1551, '2026-10-09', 1520, 1280, 1280
                    , 1280, 1280, 1280, 1280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1280, 1280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1520, sellCostBuyPrice =sellCostBuyPrice+1280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1520, 1280, 1280
                    , 1280, 1280, 1280, 1280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1280, 1280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1520, sellCostBuyPrice =sellCostBuyPrice+1280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '464', userid = '4', storedetaildate = '2026-10-09 12:07:32' WHERE storedetailid = '2563';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1551', '2', '4', '1', '302', 'اضافة فاتورة مبيعات', 'sellbillController.php', '468', '464', '4', '2026-10-09 12:07:32','0','0'); -- id=3947
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '414350',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('411660','2690', '0', '3', 'اضافة فاتورة مبيعات', '302', '414350', '2026-10-09 12:07:32', '4',  'sellbillController.php','1','','0'); -- id=348
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2690', '2690', '2026-10-09', '4', '0', '0', '2026-10-09 12:07:32','اضافة فاتورة مبيعات رقم 302','1','0',null,'0','302','sellbillController.php?do=showDetail&sellbillid=302'); -- id=1728
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1728', '501', '2690', '','0'); -- id=1757
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '414350', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1728', '143', '2690', '','0'); -- id=1728
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3211985', 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 ( '2330', '2330', '2026-10-09', '4', '0', '0', '2026-10-09 12:07:32','اضافة فاتورة مبيعات رقم 302 - صرف البضاعة من المخزن','1','0',null,'0','302','sellbillController.php?do=showDetail&sellbillid=302'); -- id=1729
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1729', '402', '2330', '','0'); -- id=1758
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3021092.95', 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 ('1729', '492', '2330', '','0'); -- id=1729
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '755735', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1728,0,1729' where sellbillid=302;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 2690, 2330, 2330
                    , 2330, 2330, 2330, 2330
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2330, 2330, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2690, sellCostBuyPrice =sellCostBuyPrice+2330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2330, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2330
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2330
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2330
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2330
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2690, 2330, 2330
                    , 2330, 2330, 2330, 2330
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2330, 2330, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2690, sellCostBuyPrice =sellCostBuyPrice+2330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2330, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2330
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2330
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2330
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2330
                        , returnSellVal = returnSellVal+0, 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, 2690, 2330, 2330
                    , 2330, 2330, 2330, 2330, 2330, 2330)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2690, netSellCostBuyPrice = netSellCostBuyPrice+2330
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2330
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2330
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2330
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2330
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2330
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2330
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2330;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8a57e1fd3e and sellbillId = 302 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:37:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:07:32", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:07:32', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5775
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:37:43";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:07:43", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:07:43', '6', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=284'); -- id=5776
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:37:46";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:07:46", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:07:46', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5777
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:38:11";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:08:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:08:11', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=5778
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:38:31";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:08:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:08:31', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=5779
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:38:37";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:08:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:08:37', '1', 'editbill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=88'); -- id=5780
UPDATE user SET loginip = "" WHERE userid = 6;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:38:48";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:38:49";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:38:52";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:08:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:08:52', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=5781
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:38:54";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:08:54", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 12:08:54', '6', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5782
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:38:55";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 12:08:55", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 12:08:55', '6', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5783
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:38:57";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:08:57", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:08:57', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5784
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:39:12";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:09:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:09:12', '1', 'editbill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=82'); -- id=5785
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:39:17";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:09:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:09:17', '1', 'update', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=update'); -- id=5786
BEGIN;
UPDATE costcenterdetail SET del = 1 WHERE type in( 3) and  modelid = 82;
UPDATE buybill SET  buybillsysdate = '2026-10-09 12:09:17', userid = '1',delbyuserid = '1', conditions = '1' WHERE buybillid = '82';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-08 16:09:52', 1, 1738, 0, 0
                    , 750, 24, 0, 0, 1, '2026-10-09 12:09:17')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-24, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 12:09:17' ; -- id=651
UPDATE buybilldetail SET  lastbuyprice = 750.00 , meanbuyprice = 725.00, lastbuyprice_withDiscount = 750.00, meanbuyprice_withDiscount = 725.00
        , lastbuyprice_withTax = 725.00, meanbuyprice_withTax = 725.00, lastbuyprice_withDiscountAndTax = 750.00
                where buybilldetailid = 514;
UPDATE product SET productName = 'جاكيت محجر ماتيجو ', productDescription = '', productCatId = '135', productBuyPrice = '700.00', productSellAllPrice = '750.00', productSellUnitPrice = '750.00', productSellHalfPrice = '750.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01738',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '750',lastbuyprice_withDiscount = '0',meanbuyprice = '700.00',meanbuyprice_withDiscount = '700' , productbuypricereal = '750.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='750',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='750',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1738';
UPDATE productunit SET proUnitBuyPrice  = 750 * productnumber WHERE productid = 1738;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2751';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1738', '1', '24', '1', '82', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '24', '0', '1', '2026-10-08 16:09:52','0','0'); -- id=3948
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-08 16:09:52', 1, 1739, 0, 0
                    , 650, 72, 0, 0, 1, '2026-10-09 12:09:17')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-72, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 12:09:17' ; -- id=652
UPDATE buybilldetail SET  lastbuyprice = 650.00 , meanbuyprice = 625.00, lastbuyprice_withDiscount = 650.00, meanbuyprice_withDiscount = 625.00
        , lastbuyprice_withTax = 625.00, meanbuyprice_withTax = 625.00, lastbuyprice_withDiscountAndTax = 650.00
                where buybilldetailid = 515;
UPDATE product SET productName = 'جاكيت ماتيجو 650', productDescription = '', productCatId = '135', productBuyPrice = '600.00', productSellAllPrice = '650.00', productSellUnitPrice = '650.00', productSellHalfPrice = '650.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01739',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '0',meanbuyprice = '600.00',meanbuyprice_withDiscount = '600' , productbuypricereal = '650.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='650',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='650',meanbuyprice_withTax='0',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='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1739';
UPDATE productunit SET proUnitBuyPrice  = 650 * productnumber WHERE productid = 1739;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2752';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1739', '1', '72', '1', '82', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '72', '0', '1', '2026-10-08 16:09:52','0','0'); -- id=3949
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-08 16:09:52', 1, 1740, 0, 0
                    , 700, 48, 0, 0, 1, '2026-10-09 12:09:17')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-48, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 12:09:17' ; -- id=653
UPDATE buybilldetail SET  lastbuyprice = 700.00 , meanbuyprice = 675.00, lastbuyprice_withDiscount = 700.00, meanbuyprice_withDiscount = 675.00
        , lastbuyprice_withTax = 675.00, meanbuyprice_withTax = 675.00, lastbuyprice_withDiscountAndTax = 700.00
                where buybilldetailid = 516;
UPDATE product SET productName = 'جاكيت ماتيجو 700', productDescription = '', productCatId = '135', productBuyPrice = '650.00', productSellAllPrice = '700.00', productSellUnitPrice = '700.00', productSellHalfPrice = '700.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01740',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '700',lastbuyprice_withDiscount = '0',meanbuyprice = '650.00',meanbuyprice_withDiscount = '650' , productbuypricereal = '700.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='700',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='700',meanbuyprice_withTax='0',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='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1740';
UPDATE productunit SET proUnitBuyPrice  = 700 * productnumber WHERE productid = 1740;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2753';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1740', '1', '48', '1', '82', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '48', '0', '1', '2026-10-08 16:09:52','0','0'); -- id=3950
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-08 16:09:52', 1, 1741, 0, 0
                    , 450, 24, 0, 0, 1, '2026-10-09 12:09:17')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-24, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 12:09:17' ; -- id=654
UPDATE buybilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425.00, meanbuyprice_withTax = 425.00, lastbuyprice_withDiscountAndTax = 450.00
                where buybilldetailid = 517;
UPDATE product SET productName = 'جاكيت ماتيجو 450', productDescription = '', productCatId = '135', productBuyPrice = '400.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01741',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '0',meanbuyprice = '400.00',meanbuyprice_withDiscount = '400' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='0',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='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1741';
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 1741;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2754';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1741', '1', '24', '1', '82', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '24', '0', '1', '2026-10-08 16:09:52','0','0'); -- id=3951
UPDATE supplier SET  suppliercurrentDebt = '163780',suppliercurrentDebtInCurrency= '163780' , userid = '1', supplierdate = '2026-10-09 12:09:17'   WHERE supplierid = '130';
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 ('130', '272980.00', '109200.00', '1', 'حذف فاتورة مشتريات - للتعديل', '82', '163780', '2026-10-08 16:09:52', '1', 'buyBillController.php', 'حذف فاتورة مشتريات - للتعديل', '0','', '0','1','1','109200','1','272980','109200','163780','0',''); -- id=283
UPDATE productserial SET del = 1
		 WHERE billid = 82;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,deletedbuyid,controlname,payedtax,costcenterid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06ac79620d5611', '2026-10-08 16:09:52', '130', '163780.00', '272980', '0', '0', '109200.00', '109200.00', '0.00', '109200', '1', '2026-10-09 12:09:17', '', '1', '0', '', '1', '1','1','82','buyBillController.php','0.00','-1','1','0','0','.','0','0','0','0','0','0'); -- id=90
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 ('01738', '90', '135', '1738', '24.00', '750', '18000.00', '0.00', '', '2026-10-09 12:09:17', '1738','','','0','0','0','0','0',null,'750','18000','0','0','0','0','0','0','0','0','1'); -- id=582
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-08 16:09:52', 1, 1738, 0, 0
                    , 750, 24, 0, 0, 1, '2026-10-09 12:09:17')
                ON DUPLICATE KEY UPDATE buyprice = 750,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 12:09:17' ; -- id=651
UPDATE product SET  productBuyPrice = "750" WHERE productId = 1738 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 582 ;
UPDATE product SET productName = 'جاكيت محجر ماتيجو ', productDescription = '', productCatId = '135', productBuyPrice = '750.00', productSellAllPrice = '750.00', productSellUnitPrice = '750.00', productSellHalfPrice = '750.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01738',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '750',lastbuyprice_withDiscount = '750',meanbuyprice = '725',meanbuyprice_withDiscount = '725' , productbuypricereal = '750.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='750',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='750',meanbuyprice_withTax='375',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='750',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1738';
UPDATE buybilldetail SET  lastbuyprice = 750 , meanbuyprice = 725, lastbuyprice_withDiscount = 750, meanbuyprice_withDiscount = 725
        , lastbuyprice_withTax = 750, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 750
                where buybilldetailid = 582;
UPDATE productunit SET proUnitBuyPrice  = 750 * productnumber WHERE productid = 1738;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2751';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1738', '1', '24', '0', '90', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-08 16:09:52','0','0'); -- id=3952
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 ('01739', '90', '135', '1739', '72.00', '650', '46800.00', '0.00', '', '2026-10-09 12:09:17', '1739','','','0','0','0','0','0',null,'650','46800','0','0','0','0','0','0','0','0','1'); -- id=583
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-08 16:09:52', 1, 1739, 0, 0
                    , 650, 72, 0, 0, 1, '2026-10-09 12:09:17')
                ON DUPLICATE KEY UPDATE buyprice = 650,
                        buyQuantity =buyQuantity+72, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 12:09:17' ; -- id=652
UPDATE product SET  productBuyPrice = "650" WHERE productId = 1739 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 583 ;
UPDATE product SET productName = 'جاكيت ماتيجو 650', productDescription = '', productCatId = '135', productBuyPrice = '650.00', productSellAllPrice = '650.00', productSellUnitPrice = '650.00', productSellHalfPrice = '650.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01739',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '650',meanbuyprice = '625',meanbuyprice_withDiscount = '625' , productbuypricereal = '650.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='650',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='650',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='650',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1739';
UPDATE buybilldetail SET  lastbuyprice = 650 , meanbuyprice = 625, lastbuyprice_withDiscount = 650, meanbuyprice_withDiscount = 625
        , lastbuyprice_withTax = 650, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 650
                where buybilldetailid = 583;
UPDATE productunit SET proUnitBuyPrice  = 650 * productnumber WHERE productid = 1739;
UPDATE storedetail SET  productquantity = '72', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2752';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1739', '1', '72', '0', '90', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '72', '1', '2026-10-08 16:09:52','0','0'); -- id=3953
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 ('01740', '90', '135', '1740', '48.00', '700', '33600.00', '0.00', '', '2026-10-09 12:09:17', '1740','','','0','0','0','0','0',null,'700','33600','0','0','0','0','0','0','0','0','1'); -- id=584
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-08 16:09:52', 1, 1740, 0, 0
                    , 700, 48, 0, 0, 1, '2026-10-09 12:09:17')
                ON DUPLICATE KEY UPDATE buyprice = 700,
                        buyQuantity =buyQuantity+48, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 12:09:17' ; -- id=653
UPDATE product SET  productBuyPrice = "700" WHERE productId = 1740 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 584 ;
UPDATE product SET productName = 'جاكيت ماتيجو 700', productDescription = '', productCatId = '135', productBuyPrice = '700.00', productSellAllPrice = '700.00', productSellUnitPrice = '700.00', productSellHalfPrice = '700.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01740',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '700',lastbuyprice_withDiscount = '700',meanbuyprice = '675',meanbuyprice_withDiscount = '675' , productbuypricereal = '700.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='700',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='700',meanbuyprice_withTax='350',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='700',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1740';
UPDATE buybilldetail SET  lastbuyprice = 700 , meanbuyprice = 675, lastbuyprice_withDiscount = 700, meanbuyprice_withDiscount = 675
        , lastbuyprice_withTax = 700, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 700
                where buybilldetailid = 584;
UPDATE productunit SET proUnitBuyPrice  = 700 * productnumber WHERE productid = 1740;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2753';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1740', '1', '48', '0', '90', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '48', '1', '2026-10-08 16:09:52','0','0'); -- id=3954
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 ('01741', '90', '135', '1741', '24.00', '450', '10800.00', '0.00', '', '2026-10-09 12:09:17', '1741','','','0','0','0','0','0',null,'450','10800','0','0','0','0','0','0','0','0','1'); -- id=585
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-08 16:09:52', 1, 1741, 0, 0
                    , 450, 24, 0, 0, 1, '2026-10-09 12:09:18')
                ON DUPLICATE KEY UPDATE buyprice = 450,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 12:09:18' ; -- id=654
UPDATE product SET  productBuyPrice = "450" WHERE productId = 1741 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 585 ;
UPDATE product SET productName = 'جاكيت ماتيجو 450', productDescription = '', productCatId = '135', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01741',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '425',meanbuyprice_withDiscount = '425' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='225',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='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1741';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 425, lastbuyprice_withDiscount = 450, meanbuyprice_withDiscount = 425
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 225, lastbuyprice_withDiscountAndTax = 450
                where buybilldetailid = 585;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 1741;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2754';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1741', '1', '24', '0', '90', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-08 16:09:52','0','0'); -- id=3955
DELETE FROM productserial WHERE billid = 82
		and type =0 
		;
UPDATE supplier SET  suppliercurrentDebt = '272980',suppliercurrentDebtInCurrency= '272980' , userid = '1', supplierdate = '2026-10-09 12:09:17'   WHERE supplierid = '130';
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 ('130', '163780.00', '109200', '0', 'اضافة فاتورة مشتريات', '90', '272980', '2026-10-09 12:09:17', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','109200','1','163780','109200','272980','0',''); -- id=284
UPDATE dailyentry SET totalcreditor = '109200.00', totaldebtor = '109200.00', thedate = '2026-10-08', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-08 16:14:13', entryComment = 'اضافة فاتورة مشتريات رقم 82', fromFlag = '1',related='0',isopeningentry='0',operationId='82',operationDetailLink='buyBillController.php?do=details&id=82' WHERE id = '1517';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '109200.00', '109200.00', '2026-10-09', '1', '0', '1517', '2026-10-09 12:09:18','تم عكس القيد رقم 1517 ','1','0','-1','0','0',''); -- id=1730
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1730', '382', '109200.00', '','0'); -- id=1730
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19881955.25', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1730', '613', '109200.00', '','0'); -- id=1759
UPDATE accountstree SET name = 'ماتيجو', customName = 'ماتيجو', customNameEn = 'ماتيجو', nameEn = 'ماتيجو', parent = '81', accountNature = '1', theValue = '163780', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 16:11:08' WHERE id = '613';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '109200', '109200', '2026-10-09', '1', '0', '0', '2026-10-09 12:09:18','اضافة فاتورة مشتريات رقم 90','1','0',null,'0','90','buyBillController.php?do=details&id=90'); -- id=1731
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1731', '382', '109200', '','0'); -- id=1760
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19991155.25', 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 ('1731', '613', '109200', '','0'); -- id=1731
UPDATE accountstree SET name = 'ماتيجو', customName = 'ماتيجو', customNameEn = 'ماتيجو', nameEn = 'ماتيجو', parent = '81', accountNature = '1', theValue = '272980', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 16:11:08' WHERE id = '613';
update buybill set dailyentryid='1731,0' where buybillid=90;
UPDATE product SET overAllAveragePrice = 750 WHERE productId = 1738;UPDATE product SET overAllAveragePrice = 650 WHERE productId = 1739;UPDATE product SET overAllAveragePrice = 700 WHERE productId = 1740;UPDATE product SET overAllAveragePrice = 450 WHERE productId = 1741;;
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:39:18";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:09:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:09:18', '1', 'editprint', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=90'); -- id=5787
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:39:21";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:09:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:09:21', '1', 'editbill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=82'); -- id=5788
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:39:23";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:09:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:09:23', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=5789
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:39:30";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:09:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:09:30', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=5790
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:39:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:09:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:09:32', '1', 'editbill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=88'); -- id=5791
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:39:40";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:09:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:09:40', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=5792
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:39:42";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:09:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:09:42', '1', 'editbill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=90'); -- id=5793
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:39:50";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:09:50", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:09:50', '6', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5794

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8af2993a93
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 12:09:50', '06ac8af2993a93', '1', '0.00', '0', '0', '1', '9960.00', '9960', '9960', '0', '1', '2026-10-09 12:09:50', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '20' ,'0','','','','','-1','0','0','0','0','0','9960','0','','0','0','9960','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=303
UPDATE client SET  clientdebt = '0', userid = '6' 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','اضافة فاتورة مبيعات','303', '0', '2026-10-09 12:09:50', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '9960', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 12:09:50','0','0','',''); -- id=411
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 55;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('440','01370', '303', '91', '1370', '12', '500', '6000', '0', '', '0', '2026-10-09 12:09:50', '1370', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','55-12,','1','1','0','0','500','6000','0','','0','0.00','0','0','0','0'); -- id=1099
UPDATE sellbilldetail SET  lastbuyprice = 440.00 , meanbuyprice = 440.00, lastbuyprice_withDiscount = 440.00, meanbuyprice_withDiscount = 440.00
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 440
                where sellbilldetailid = 1099;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1370, '2026-10-09', 6000, 5280, 5280
                    , 5280, 5280, 5280, 5280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 5280, 5280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+5280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 6000, 5280, 5280
                    , 5280, 5280, 5280, 5280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5280, 5280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+5280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '75', userid = '6', storedetaildate = '2026-10-09 12:09:50' WHERE storedetailid = '1370';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1370', '1', '12', '1', '303', 'اضافة فاتورة مبيعات', 'sellbillController.php', '87', '75', '6', '2026-10-09 12:09:50','0','0'); -- id=3956
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 449;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('420','01597', '303', '117', '1597', '8', '495', '3960', '0', '', '0', '2026-10-09 12:09:50', '1597', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','449-8,','1','1','0','0','495','3960','0','','0','0.00','0','0','0','0'); -- id=1100
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 420.00, lastbuyprice_withDiscount = 420.00, meanbuyprice_withDiscount = 420.00
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 420
                where sellbilldetailid = 1100;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1597, '2026-10-09', 3960, 3360, 3360
                    , 3360, 3360, 3360, 3360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 3360, 3360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3960, sellCostBuyPrice =sellCostBuyPrice+3360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3960, 3360, 3360
                    , 3360, 3360, 3360, 3360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3360, 3360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3960, sellCostBuyPrice =sellCostBuyPrice+3360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '6', storedetaildate = '2026-10-09 12:09:50' WHERE storedetailid = '1622';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1597', '1', '8', '1', '303', 'اضافة فاتورة مبيعات', 'sellbillController.php', '132', '124', '6', '2026-10-09 12:09:50','0','0'); -- id=3957
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '69200',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('59240','9960', '0', '4', 'اضافة فاتورة مبيعات', '303', '69200', '2026-10-09 12:09:50', '6',  'sellbillController.php','1','','0'); -- id=349
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '9960', '9960', '2026-10-09', '6', '0', '0', '2026-10-09 12:09:50','اضافة فاتورة مبيعات رقم 303','1','0',null,'0','303','sellbillController.php?do=showDetail&sellbillid=303'); -- id=1732
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1732', '568', '9960', '','0'); -- id=1761
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '69200', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1732', '143', '9960', '','0'); -- id=1732
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3221945', 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 ( '8640', '8640', '2026-10-09', '6', '0', '0', '2026-10-09 12:09:50','اضافة فاتورة مبيعات رقم 303 - صرف البضاعة من المخزن','1','0',null,'0','303','sellbillController.php?do=showDetail&sellbillid=303'); -- id=1733
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1733', '402', '8640', '','0'); -- id=1762
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3029732.95', 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 ('1733', '382', '8640', '','0'); -- id=1733
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19982515.25', 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='1732,0,1733' where sellbillid=303;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 9960, 8640, 8640
                    , 8640, 8640, 8640, 8640
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8640, 8640, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9960, sellCostBuyPrice =sellCostBuyPrice+8640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8640, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8640
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8640
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8640
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 9960, 8640, 8640
                    , 8640, 8640, 8640, 8640
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8640, 8640, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9960, sellCostBuyPrice =sellCostBuyPrice+8640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8640, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8640
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8640
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8640
                        , returnSellVal = returnSellVal+0, 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, 9960, 8640, 8640
                    , 8640, 8640, 8640, 8640, 8640, 8640)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+9960, netSellCostBuyPrice = netSellCostBuyPrice+8640
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+8640
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+8640
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+8640
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+8640
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+8640
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+8640
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+8640;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8af2993a93 and sellbillId = 303 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:39:50";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:09:50", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:09:50', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5795
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:40:27";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:10:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:10:27', '1', 'update', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=update'); -- id=5796
BEGIN;
UPDATE costcenterdetail SET del = 1 WHERE type in( 3) and  modelid = 90;
UPDATE buybill SET  buybillsysdate = '2026-10-09 12:10:27', userid = '1',delbyuserid = '1', conditions = '1' WHERE buybillid = '90';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-08 16:09:52', 1, 1738, 0, 0
                    , 750, 24, 0, 0, 1, '2026-10-09 12:10:27')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-24, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 12:10:27' ; -- id=651
UPDATE buybilldetail SET  lastbuyprice = 750.00 , meanbuyprice = 725.00, lastbuyprice_withDiscount = 750.00, meanbuyprice_withDiscount = 725.00
        , lastbuyprice_withTax = 750.00, meanbuyprice_withTax = 375.00, lastbuyprice_withDiscountAndTax = 750.00
                where buybilldetailid = 582;
UPDATE product SET productName = 'جاكيت محجر ماتيجو ', productDescription = '', productCatId = '135', productBuyPrice = '750.00', productSellAllPrice = '750.00', productSellUnitPrice = '750.00', productSellHalfPrice = '750.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01738',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '750',lastbuyprice_withDiscount = '0',meanbuyprice = '750.00',meanbuyprice_withDiscount = '750' , productbuypricereal = '750.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='750',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='750',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1738';
UPDATE productunit SET proUnitBuyPrice  = 750 * productnumber WHERE productid = 1738;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2751';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1738', '1', '24', '1', '90', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '24', '0', '1', '2026-10-08 16:09:52','0','0'); -- id=3958
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-08 16:09:52', 1, 1739, 0, 0
                    , 650, 72, 0, 0, 1, '2026-10-09 12:10:27')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-72, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 12:10:27' ; -- id=652
UPDATE buybilldetail SET  lastbuyprice = 650.00 , meanbuyprice = 625.00, lastbuyprice_withDiscount = 650.00, meanbuyprice_withDiscount = 625.00
        , lastbuyprice_withTax = 650.00, meanbuyprice_withTax = 325.00, lastbuyprice_withDiscountAndTax = 650.00
                where buybilldetailid = 583;
UPDATE product SET productName = 'جاكيت ماتيجو 650', productDescription = '', productCatId = '135', productBuyPrice = '650.00', productSellAllPrice = '650.00', productSellUnitPrice = '650.00', productSellHalfPrice = '650.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01739',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '0',meanbuyprice = '650.00',meanbuyprice_withDiscount = '650' , productbuypricereal = '650.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='650',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='650',meanbuyprice_withTax='0',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='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1739';
UPDATE productunit SET proUnitBuyPrice  = 650 * productnumber WHERE productid = 1739;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2752';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1739', '1', '72', '1', '90', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '72', '0', '1', '2026-10-08 16:09:52','0','0'); -- id=3959
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-08 16:09:52', 1, 1740, 0, 0
                    , 700, 48, 0, 0, 1, '2026-10-09 12:10:27')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-48, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 12:10:27' ; -- id=653
UPDATE buybilldetail SET  lastbuyprice = 700.00 , meanbuyprice = 675.00, lastbuyprice_withDiscount = 700.00, meanbuyprice_withDiscount = 675.00
        , lastbuyprice_withTax = 700.00, meanbuyprice_withTax = 350.00, lastbuyprice_withDiscountAndTax = 700.00
                where buybilldetailid = 584;
UPDATE product SET productName = 'جاكيت ماتيجو 700', productDescription = '', productCatId = '135', productBuyPrice = '700.00', productSellAllPrice = '700.00', productSellUnitPrice = '700.00', productSellHalfPrice = '700.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01740',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '700',lastbuyprice_withDiscount = '0',meanbuyprice = '700.00',meanbuyprice_withDiscount = '700' , productbuypricereal = '700.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='700',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='700',meanbuyprice_withTax='0',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='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1740';
UPDATE productunit SET proUnitBuyPrice  = 700 * productnumber WHERE productid = 1740;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2753';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1740', '1', '48', '1', '90', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '48', '0', '1', '2026-10-08 16:09:52','0','0'); -- id=3960
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-08 16:09:52', 1, 1741, 0, 0
                    , 450, 24, 0, 0, 1, '2026-10-09 12:10:27')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-24, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 12:10:27' ; -- id=654
UPDATE buybilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 450.00, meanbuyprice_withTax = 225.00, lastbuyprice_withDiscountAndTax = 450.00
                where buybilldetailid = 585;
UPDATE product SET productName = 'جاكيت ماتيجو 450', productDescription = '', productCatId = '135', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01741',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '0',meanbuyprice = '450.00',meanbuyprice_withDiscount = '450' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='0',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='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1741';
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 1741;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2754';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1741', '1', '24', '1', '90', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '24', '0', '1', '2026-10-08 16:09:52','0','0'); -- id=3961
UPDATE supplier SET  suppliercurrentDebt = '163780',suppliercurrentDebtInCurrency= '163780' , userid = '1', supplierdate = '2026-10-09 12:10:27'   WHERE supplierid = '130';
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 ('130', '272980.00', '109200.00', '1', 'حذف فاتورة مشتريات - للتعديل', '90', '163780', '2026-10-08 16:09:52', '1', 'buyBillController.php', 'حذف فاتورة مشتريات - للتعديل', '0','', '0','1','1','109200','1','272980','109200','163780','0',''); -- id=285
UPDATE productserial SET del = 1
		 WHERE billid = 90;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,deletedbuyid,controlname,payedtax,costcenterid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06ac79620d5611', '2026-10-08 16:09:52', '130', '163780.00', '272580', '0', '0', '108800.00', '108800.00', '0.00', '108800', '1', '2026-10-09 12:10:27', '', '1', '0', '', '1', '1','1','90','buyBillController.php','0.00','-1','1','0','0','.','0','0','0','0','0','0'); -- id=91
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 ('01738', '91', '135', '1738', '20', '750', '15000.00', '0.00', '', '2026-10-09 12:10:27', '1738','','','0','0','0','0','0',null,'750','15000','0','0','0','0','0','0','0','0','1'); -- id=586
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-08 16:09:52', 1, 1738, 0, 0
                    , 750, 20, 0, 0, 1, '2026-10-09 12:10:27')
                ON DUPLICATE KEY UPDATE buyprice = 750,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 12:10:27' ; -- id=651
UPDATE product SET  productBuyPrice = "750" WHERE productId = 1738 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 586 ;
UPDATE product SET productName = 'جاكيت محجر ماتيجو ', productDescription = '', productCatId = '135', productBuyPrice = '750.00', productSellAllPrice = '750.00', productSellUnitPrice = '750.00', productSellHalfPrice = '750.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01738',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '750',lastbuyprice_withDiscount = '750',meanbuyprice = '750',meanbuyprice_withDiscount = '750' , productbuypricereal = '750.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='750',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='750',meanbuyprice_withTax='340.91',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='750',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1738';
UPDATE buybilldetail SET  lastbuyprice = 750 , meanbuyprice = 750, lastbuyprice_withDiscount = 750, meanbuyprice_withDiscount = 750
        , lastbuyprice_withTax = 750, meanbuyprice_withTax = 340.91, lastbuyprice_withDiscountAndTax = 750
                where buybilldetailid = 586;
UPDATE productunit SET proUnitBuyPrice  = 750 * productnumber WHERE productid = 1738;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2751';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1738', '1', '20', '0', '91', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '20', '1', '2026-10-08 16:09:52','0','0'); -- id=3962
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 ('01739', '91', '135', '1739', '76.00', '650', '49400.00', '0.00', '', '2026-10-09 12:10:27', '1739','','','0','0','0','0','0',null,'650','49400','0','0','0','0','0','0','0','0','1'); -- id=587
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-08 16:09:52', 1, 1739, 0, 0
                    , 650, 76, 0, 0, 1, '2026-10-09 12:10:27')
                ON DUPLICATE KEY UPDATE buyprice = 650,
                        buyQuantity =buyQuantity+76, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 12:10:27' ; -- id=652
UPDATE product SET  productBuyPrice = "650" WHERE productId = 1739 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 587 ;
UPDATE product SET productName = 'جاكيت ماتيجو 650', productDescription = '', productCatId = '135', productBuyPrice = '650.00', productSellAllPrice = '650.00', productSellUnitPrice = '650.00', productSellHalfPrice = '650.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01739',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '650',meanbuyprice = '650',meanbuyprice_withDiscount = '650' , productbuypricereal = '650.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='650',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='650',meanbuyprice_withTax='333.78',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='650',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1739';
UPDATE buybilldetail SET  lastbuyprice = 650 , meanbuyprice = 650, lastbuyprice_withDiscount = 650, meanbuyprice_withDiscount = 650
        , lastbuyprice_withTax = 650, meanbuyprice_withTax = 333.78, lastbuyprice_withDiscountAndTax = 650
                where buybilldetailid = 587;
UPDATE productunit SET proUnitBuyPrice  = 650 * productnumber WHERE productid = 1739;
UPDATE storedetail SET  productquantity = '76', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2752';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1739', '1', '76', '0', '91', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '76', '1', '2026-10-08 16:09:52','0','0'); -- id=3963
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 ('01740', '91', '135', '1740', '48.00', '700', '33600.00', '0.00', '', '2026-10-09 12:10:27', '1740','','','0','0','0','0','0',null,'700','33600','0','0','0','0','0','0','0','0','1'); -- id=588
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-08 16:09:52', 1, 1740, 0, 0
                    , 700, 48, 0, 0, 1, '2026-10-09 12:10:27')
                ON DUPLICATE KEY UPDATE buyprice = 700,
                        buyQuantity =buyQuantity+48, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 12:10:27' ; -- id=653
UPDATE product SET  productBuyPrice = "700" WHERE productId = 1740 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 588 ;
UPDATE product SET productName = 'جاكيت ماتيجو 700', productDescription = '', productCatId = '135', productBuyPrice = '700.00', productSellAllPrice = '700.00', productSellUnitPrice = '700.00', productSellHalfPrice = '700.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01740',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '700',lastbuyprice_withDiscount = '700',meanbuyprice = '700',meanbuyprice_withDiscount = '700' , productbuypricereal = '700.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='700',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='700',meanbuyprice_withTax='350',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='700',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1740';
UPDATE buybilldetail SET  lastbuyprice = 700 , meanbuyprice = 700, lastbuyprice_withDiscount = 700, meanbuyprice_withDiscount = 700
        , lastbuyprice_withTax = 700, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 700
                where buybilldetailid = 588;
UPDATE productunit SET proUnitBuyPrice  = 700 * productnumber WHERE productid = 1740;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2753';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1740', '1', '48', '0', '91', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '48', '1', '2026-10-08 16:09:52','0','0'); -- id=3964
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 ('01741', '91', '135', '1741', '24.00', '450', '10800.00', '0.00', '', '2026-10-09 12:10:27', '1741','','','0','0','0','0','0',null,'450','10800','0','0','0','0','0','0','0','0','1'); -- id=589
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-08 16:09:52', 1, 1741, 0, 0
                    , 450, 24, 0, 0, 1, '2026-10-09 12:10:27')
                ON DUPLICATE KEY UPDATE buyprice = 450,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 12:10:27' ; -- id=654
UPDATE product SET  productBuyPrice = "450" WHERE productId = 1741 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 589 ;
UPDATE product SET productName = 'جاكيت ماتيجو 450', productDescription = '', productCatId = '135', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01741',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='225',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='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1741';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 450, meanbuyprice_withDiscount = 450
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 225, lastbuyprice_withDiscountAndTax = 450
                where buybilldetailid = 589;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 1741;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2754';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1741', '1', '24', '0', '91', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-08 16:09:52','0','0'); -- id=3965
DELETE FROM productserial WHERE billid = 90
		and type =0 
		;
UPDATE supplier SET  suppliercurrentDebt = '272580',suppliercurrentDebtInCurrency= '272580' , userid = '1', supplierdate = '2026-10-09 12:10:27'   WHERE supplierid = '130';
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 ('130', '163780.00', '108800', '0', 'اضافة فاتورة مشتريات', '91', '272580', '2026-10-09 12:10:27', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','109200','1','163780','108800','272580','0',''); -- id=286
UPDATE dailyentry SET totalcreditor = '109200.00', totaldebtor = '109200.00', thedate = '2026-10-09', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 12:09:18', entryComment = 'اضافة فاتورة مشتريات رقم 90', fromFlag = '1',related='0',isopeningentry='0',operationId='90',operationDetailLink='buyBillController.php?do=details&id=90' WHERE id = '1731';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '109200.00', '109200.00', '2026-10-09', '1', '0', '1731', '2026-10-09 12:10:27','تم عكس القيد رقم 1731 ','1','0','-1','0','0',''); -- id=1734
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1734', '382', '109200.00', '','0'); -- id=1734
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19873315.25', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1734', '613', '109200.00', '','0'); -- id=1763
UPDATE accountstree SET name = 'ماتيجو', customName = 'ماتيجو', customNameEn = 'ماتيجو', nameEn = 'ماتيجو', parent = '81', accountNature = '1', theValue = '163780', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 16:11:08' WHERE id = '613';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '108800', '108800', '2026-10-09', '1', '0', '0', '2026-10-09 12:10:27','اضافة فاتورة مشتريات رقم 91','1','0',null,'0','91','buyBillController.php?do=details&id=91'); -- id=1735
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1735', '382', '108800', '','0'); -- id=1764
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19982115.25', 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 ('1735', '613', '108800', '','0'); -- id=1735
UPDATE accountstree SET name = 'ماتيجو', customName = 'ماتيجو', customNameEn = 'ماتيجو', nameEn = 'ماتيجو', parent = '81', accountNature = '1', theValue = '272580', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 16:11:08' WHERE id = '613';
update buybill set dailyentryid='1735,0' where buybillid=91;
UPDATE product SET overAllAveragePrice = 750 WHERE productId = 1738;UPDATE product SET overAllAveragePrice = 650 WHERE productId = 1739;UPDATE product SET overAllAveragePrice = 700 WHERE productId = 1740;UPDATE product SET overAllAveragePrice = 450 WHERE productId = 1741;;
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:40:27";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:10:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:10:27', '1', 'editprint', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=91'); -- id=5797
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:40:35";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:10:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:10:35', '1', 'editprint', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=91'); -- id=5798
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:40:43";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:10:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:10:43', '1', 'editprint', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=91'); -- id=5799
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:40:46";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:10:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:10:46', '1', 'editprint', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=91'); -- id=5800
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:41:50";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:11:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 12:11:50', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5801
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:41:54";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:11:54", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:11:54', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5802

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8ae03f12cd
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 12:11:54', '06ac8ae03f12cd', '1', '0.00', '0', '0', '1', '9240.00', '9240', '9240', '0', '1', '2026-10-09 12:11:54', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '24' ,'0','','','','','-1','0','0','0','0','0','9240','0','','0','0','9240','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=304
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','304', '0', '2026-10-09 12:11:54', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '9240', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 12:11:54','0','0','',''); -- id=412
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 74;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','01382', '304', '94', '1382', '15', '400', '6000', '0', '', '0', '2026-10-09 12:11:54', '1382', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','74-15,','1','1','0','0','400','6000','0','','0','0.00','0','0','0','0'); -- id=1101
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1101;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1382, '2026-10-09', 6000, 5400, 5400
                    , 5400, 5400, 5400, 5400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 5400, 5400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+5400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-10-09', 6000, 5400, 5400
                    , 5400, 5400, 5400, 5400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5400, 5400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+5400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '90', userid = '2', storedetaildate = '2026-10-09 12:11:54' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '15', '1', '304', 'اضافة فاتورة مبيعات', 'sellbillController.php', '105', '90', '2', '2026-10-09 12:11:54','0','0'); -- id=3966
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 235;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01456', '304', '94', '1456', '9', '360', '3240', '0', '', '0', '2026-10-09 12:11:54', '1456', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','235-9,','1','1','0','0','360','3240','0','','0','0.00','0','0','0','0'); -- id=1102
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 1102;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1456, '2026-10-09', 3240, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3240, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3240, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3240, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '198', userid = '2', storedetaildate = '2026-10-09 12:11:54' WHERE storedetailid = '1481';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1456', '1', '9', '1', '304', 'اضافة فاتورة مبيعات', 'sellbillController.php', '207', '198', '2', '2026-10-09 12:11:54','0','0'); -- id=3967
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1750445',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1741205','9240', '0', '2', 'اضافة فاتورة مبيعات', '304', '1750445', '2026-10-09 12:11:54', '2',  'sellbillController.php','1','','0'); -- id=350
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '9240', '9240', '2026-10-09', '2', '0', '0', '2026-10-09 12:11:54','اضافة فاتورة مبيعات رقم 304','1','0',null,'0','304','sellbillController.php?do=showDetail&sellbillid=304'); -- id=1736
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1736', '419', '9240', '','0'); -- id=1765
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1750445', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1736', '143', '9240', '','0'); -- id=1736
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3231185', 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 ( '8280', '8280', '2026-10-09', '2', '0', '0', '2026-10-09 12:11:54','اضافة فاتورة مبيعات رقم 304 - صرف البضاعة من المخزن','1','0',null,'0','304','sellbillController.php?do=showDetail&sellbillid=304'); -- id=1737
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1737', '402', '8280', '','0'); -- id=1766
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3038012.95', 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 ('1737', '382', '8280', '','0'); -- id=1737
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19973835.25', 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='1736,0,1737' where sellbillid=304;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 9240, 8280, 8280
                    , 8280, 8280, 8280, 8280
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8280, 8280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9240, sellCostBuyPrice =sellCostBuyPrice+8280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 9240, 8280, 8280
                    , 8280, 8280, 8280, 8280
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8280, 8280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9240, sellCostBuyPrice =sellCostBuyPrice+8280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8280
                        , returnSellVal = returnSellVal+0, 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, 9240, 8280, 8280
                    , 8280, 8280, 8280, 8280, 8280, 8280)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+9240, netSellCostBuyPrice = netSellCostBuyPrice+8280
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+8280
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+8280
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+8280
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+8280
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+8280
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+8280
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+8280;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8ae03f12cd and sellbillId = 304 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:41:54";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:11:54", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:11:54', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5803
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:42:00";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:12:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 12:12:00', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5804
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:42:07";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:12:07", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:12:07', '2', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=304'); -- id=5805
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:42:10";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:12:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 12:12:10', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5806
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:42:12";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:12:12", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:12:12', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5807
UPDATE product SET productName = 'سليم ار ايه 330', productDescription = '', productCatId = '4', productBuyPrice = '310.00', productSellAllPrice = '330.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09675',type ='0', expireDate = '0' , dailyentryId = '2',isService = '0',isOptic = '0',lastbuyprice = '310.00',lastbuyprice_withDiscount = '310',meanbuyprice = '310.00',meanbuyprice_withDiscount = '310' , productbuypricereal = '310.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9675',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='310',meanbuyprice_withTax='310',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='1',lastbuyprice_withDiscountAndTax='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '647';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (647, 1,'2026-10-09 12:13:50',1)
                ON DUPLICATE KEY UPDATE productid = 647, edited = 1, sysdate = '2026-10-09 12:13:50', userid = 1; -- id=1292
UPDATE product SET productName = 'سليم ار ايه 330', productDescription = '', productCatId = '4', productBuyPrice = '310.00', productSellAllPrice = '330.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09675',type ='0', expireDate = '0' , dailyentryId = '2',isService = '0',isOptic = '0',lastbuyprice = '310.00',lastbuyprice_withDiscount = '310',meanbuyprice = '310.00',meanbuyprice_withDiscount = '310' , productbuypricereal = '310.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9675',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='310',meanbuyprice_withTax='310',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='1',lastbuyprice_withDiscountAndTax='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '647';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (647, 1,'2026-10-09 12:14:20',1)
                ON DUPLICATE KEY UPDATE productid = 647, edited = 1, sysdate = '2026-10-09 12:14:20', userid = 1; -- id=1292
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '345', '345', '2026-10-09', '1', '0', '0', '2026-10-09 12:14:22','تعديل منتج (سليم ار ايه 330) السعر من (310.00) الى (315.00) و الكميه (69)','1','0',null,'0','647','productController.php?do=edit&id=647'); -- id=1738
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1738', '382', '345', '','0'); -- id=1767
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19974180.25', 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 ('1738', '53', '345', '','0'); -- id=1738
UPDATE accountstree SET name = 'فروقات اعاده تقييم بضاعه', customName = 'فروقات اعاده تقييم بضاعه', customNameEn = '', nameEn = '', parent = '147', accountNature = '1', theValue = '-235310', theOrder = '0', layingOrder = '4201', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '2', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2024-05-07 12:08:31' WHERE id = '53';
COMMIT;
UPDATE productunit SET proUnitBuyPrice  = 315.00 * productnumber WHERE productid = 647;
UPDATE product SET productName = 'سليم ار ايه 330', productDescription = '', productCatId = '4', productBuyPrice = '315.00', productSellAllPrice = '330.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09675',type ='0', expireDate = '0' , dailyentryId = '2',isService = '0',isOptic = '0',lastbuyprice = '310.00',lastbuyprice_withDiscount = '310',meanbuyprice = '312.5',meanbuyprice_withDiscount = '312.5' , productbuypricereal = '310.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9675',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='312.5',meanbuyprice_withTax='312.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='1',lastbuyprice_withDiscountAndTax='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '647';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (647, 1,'2026-10-09 12:14:22',1)
                ON DUPLICATE KEY UPDATE productid = 647, edited = 1, sysdate = '2026-10-09 12:14:22', userid = 1; -- id=1292
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '245', '245', '2026-10-09', '1', '0', '0', '2026-10-09 12:14:23','تعديل منتج (بوي فريند درب ار ايه 360) السعر من (340.00) الى (345.00) و الكميه (49)','1','0',null,'0','648','productController.php?do=edit&id=648'); -- id=1739
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1739', '382', '245', '','0'); -- id=1768
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19974425.25', 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 ('1739', '53', '245', '','0'); -- id=1739
UPDATE accountstree SET name = 'فروقات اعاده تقييم بضاعه', customName = 'فروقات اعاده تقييم بضاعه', customNameEn = '', nameEn = '', parent = '147', accountNature = '1', theValue = '-235065', theOrder = '0', layingOrder = '4201', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '2', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2024-05-07 12:08:31' WHERE id = '53';
COMMIT;
UPDATE productunit SET proUnitBuyPrice  = 345.00 * productnumber WHERE productid = 648;
UPDATE product SET productName = 'بوي فريند درب ار ايه 360', productDescription = '', productCatId = '4', productBuyPrice = '345.00', productSellAllPrice = '360.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09676',type ='0', expireDate = '0' , dailyentryId = '3',isService = '0',isOptic = '0',lastbuyprice = '340.00',lastbuyprice_withDiscount = '340',meanbuyprice = '342.5',meanbuyprice_withDiscount = '342.5' , productbuypricereal = '340.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='340',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9676',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='342.5',meanbuyprice_withTax='342.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='1',lastbuyprice_withDiscountAndTax='340',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '648';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (648, 1,'2026-10-09 12:14:23',1)
                ON DUPLICATE KEY UPDATE productid = 648, edited = 1, sysdate = '2026-10-09 12:14:23', userid = 1; -- id=1293
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '220', '220', '2026-10-09', '1', '0', '0', '2026-10-09 12:14:26','تعديل منتج (بوي فريند ساده ار ايه 310) السعر من (290.00) الى (295.00) و الكميه (44)','1','0',null,'0','649','productController.php?do=edit&id=649'); -- id=1740
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1740', '382', '220', '','0'); -- id=1769
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19974645.25', 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 ('1740', '53', '220', '','0'); -- id=1740
UPDATE accountstree SET name = 'فروقات اعاده تقييم بضاعه', customName = 'فروقات اعاده تقييم بضاعه', customNameEn = '', nameEn = '', parent = '147', accountNature = '1', theValue = '-234845', theOrder = '0', layingOrder = '4201', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '2', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2024-05-07 12:08:31' WHERE id = '53';
COMMIT;
UPDATE productunit SET proUnitBuyPrice  = 295.00 * productnumber WHERE productid = 649;
UPDATE product SET productName = 'بوي فريند ساده ار ايه 310', productDescription = '', productCatId = '4', productBuyPrice = '295.00', productSellAllPrice = '310.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09677',type ='0', expireDate = '0' , dailyentryId = '4',isService = '0',isOptic = '0',lastbuyprice = '290.00',lastbuyprice_withDiscount = '290',meanbuyprice = '292.5',meanbuyprice_withDiscount = '292.5' , productbuypricereal = '290.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='290',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9677',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='292.5',meanbuyprice_withTax='292.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='1',lastbuyprice_withDiscountAndTax='290',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '649';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (649, 1,'2026-10-09 12:14:26',1)
                ON DUPLICATE KEY UPDATE productid = 649, edited = 1, sysdate = '2026-10-09 12:14:26', userid = 1; -- id=1294
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '370', '370', '2026-10-09', '1', '0', '0', '2026-10-09 12:14:31','تعديل منتج (وايد ليج ساده ار ايه 330) السعر من (310.00) الى (315.00) و الكميه (74)','1','0',null,'0','650','productController.php?do=edit&id=650'); -- id=1741
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1741', '382', '370', '','0'); -- id=1770
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19975015.25', 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 ('1741', '53', '370', '','0'); -- id=1741
UPDATE accountstree SET name = 'فروقات اعاده تقييم بضاعه', customName = 'فروقات اعاده تقييم بضاعه', customNameEn = '', nameEn = '', parent = '147', accountNature = '1', theValue = '-234475', theOrder = '0', layingOrder = '4201', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '2', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2024-05-07 12:08:31' WHERE id = '53';
COMMIT;
UPDATE productunit SET proUnitBuyPrice  = 315.00 * productnumber WHERE productid = 650;
UPDATE product SET productName = 'وايد ليج ساده ار ايه 330', productDescription = '', productCatId = '4', productBuyPrice = '315.00', productSellAllPrice = '330.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09678',type ='0', expireDate = '0' , dailyentryId = '5',isService = '0',isOptic = '0',lastbuyprice = '310.00',lastbuyprice_withDiscount = '310',meanbuyprice = '312.5',meanbuyprice_withDiscount = '312.5' , productbuypricereal = '310.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9678',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='312.5',meanbuyprice_withTax='312.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='1',lastbuyprice_withDiscountAndTax='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '650';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (650, 1,'2026-10-09 12:14:31',1)
                ON DUPLICATE KEY UPDATE productid = 650, edited = 1, sysdate = '2026-10-09 12:14:31', userid = 1; -- id=1295
UPDATE product SET productName = 'بوي فريند درب ار ايه 360', productDescription = '', productCatId = '4', productBuyPrice = '345.00', productSellAllPrice = '360.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09676',type ='0', expireDate = '0' , dailyentryId = '3',isService = '0',isOptic = '0',lastbuyprice = '340.00',lastbuyprice_withDiscount = '340',meanbuyprice = '342.50',meanbuyprice_withDiscount = '342.5' , productbuypricereal = '340.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='340',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9676',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='342.5',meanbuyprice_withTax='342.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='1',lastbuyprice_withDiscountAndTax='340',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '648';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (648, 1,'2026-10-09 12:14:35',1)
                ON DUPLICATE KEY UPDATE productid = 648, edited = 1, sysdate = '2026-10-09 12:14:35', userid = 1; -- id=1293
UPDATE product SET productName = 'بوي فريند درب ار ايه 360', productDescription = '', productCatId = '4', productBuyPrice = '345.00', productSellAllPrice = '360.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09676',type ='0', expireDate = '0' , dailyentryId = '3',isService = '0',isOptic = '0',lastbuyprice = '340.00',lastbuyprice_withDiscount = '340',meanbuyprice = '342.50',meanbuyprice_withDiscount = '342.5' , productbuypricereal = '340.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='340',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9676',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='342.5',meanbuyprice_withTax='342.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='1',lastbuyprice_withDiscountAndTax='340',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '648';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (648, 1,'2026-10-09 12:14:41',1)
                ON DUPLICATE KEY UPDATE productid = 648, edited = 1, sysdate = '2026-10-09 12:14:41', userid = 1; -- id=1293
UPDATE product SET productName = 'بوي فريند ساده ار ايه 310', productDescription = '', productCatId = '4', productBuyPrice = '295.00', productSellAllPrice = '310.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09677',type ='0', expireDate = '0' , dailyentryId = '4',isService = '0',isOptic = '0',lastbuyprice = '290.00',lastbuyprice_withDiscount = '290',meanbuyprice = '292.50',meanbuyprice_withDiscount = '292.5' , productbuypricereal = '290.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='290',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9677',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='292.5',meanbuyprice_withTax='292.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='1',lastbuyprice_withDiscountAndTax='290',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '649';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (649, 1,'2026-10-09 12:14:43',1)
                ON DUPLICATE KEY UPDATE productid = 649, edited = 1, sysdate = '2026-10-09 12:14:43', userid = 1; -- id=1294
UPDATE product SET productName = 'بوي فريند ساده ار ايه 310', productDescription = '', productCatId = '4', productBuyPrice = '295.00', productSellAllPrice = '310.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09677',type ='0', expireDate = '0' , dailyentryId = '4',isService = '0',isOptic = '0',lastbuyprice = '290.00',lastbuyprice_withDiscount = '290',meanbuyprice = '292.50',meanbuyprice_withDiscount = '292.5' , productbuypricereal = '290.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='290',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9677',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='292.5',meanbuyprice_withTax='292.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='1',lastbuyprice_withDiscountAndTax='290',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '649';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (649, 1,'2026-10-09 12:14:52',1)
                ON DUPLICATE KEY UPDATE productid = 649, edited = 1, sysdate = '2026-10-09 12:14:52', userid = 1; -- id=1294
UPDATE product SET productName = 'وايد ليج ساده ار ايه 330', productDescription = '', productCatId = '4', productBuyPrice = '315.00', productSellAllPrice = '330.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09678',type ='0', expireDate = '0' , dailyentryId = '5',isService = '0',isOptic = '0',lastbuyprice = '310.00',lastbuyprice_withDiscount = '310',meanbuyprice = '312.50',meanbuyprice_withDiscount = '312.5' , productbuypricereal = '310.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9678',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='312.5',meanbuyprice_withTax='312.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='1',lastbuyprice_withDiscountAndTax='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '650';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (650, 1,'2026-10-09 12:15:00',1)
                ON DUPLICATE KEY UPDATE productid = 650, edited = 1, sysdate = '2026-10-09 12:15:00', userid = 1; -- id=1295
UPDATE product SET productName = 'وايد ليج ساده ار ايه 330', productDescription = '', productCatId = '4', productBuyPrice = '315.00', productSellAllPrice = '330.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09678',type ='0', expireDate = '0' , dailyentryId = '5',isService = '0',isOptic = '0',lastbuyprice = '310.00',lastbuyprice_withDiscount = '310',meanbuyprice = '312.50',meanbuyprice_withDiscount = '312.5' , productbuypricereal = '310.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9678',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='312.5',meanbuyprice_withTax='312.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='1',lastbuyprice_withDiscountAndTax='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '650';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (650, 1,'2026-10-09 12:15:09',1)
                ON DUPLICATE KEY UPDATE productid = 650, edited = 1, sysdate = '2026-10-09 12:15:09', userid = 1; -- id=1295
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:48:18";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:18:18", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:18:18', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5808

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8afec0f79c
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 12:18:18', '06ac8afec0f79c', '1', '0.00', '0', '0', '1', '3480.00', '3480', '3480', '0', '1', '2026-10-09 12:18:18', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '9' ,'0','','','','','-1','0','0','0','0','0','3480','0','','0','0','3480','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=305
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','305', '0', '2026-10-09 12:18:18', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3480', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 12:18:18','0','0','',''); -- id=413
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 74;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','01382', '305', '94', '1382', '6', '400', '2400', '0', '', '0', '2026-10-09 12:18:18', '1382', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','74-6,','1','1','0','0','400','2400','0','','0','0.00','0','0','0','0'); -- id=1103
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1103;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1382, '2026-10-09', 2400, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2400, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '84', userid = '2', storedetaildate = '2026-10-09 12:18:18' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '6', '1', '305', 'اضافة فاتورة مبيعات', 'sellbillController.php', '90', '84', '2', '2026-10-09 12:18:18','0','0'); -- id=3968
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 235;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01456', '305', '94', '1456', '3', '360', '1080', '0', '', '0', '2026-10-09 12:18:18', '1456', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','235-3,','1','1','0','0','360','1080','0','','0','0.00','0','0','0','0'); -- id=1104
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 1104;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1456, '2026-10-09', 1080, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1080, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '195', userid = '2', storedetaildate = '2026-10-09 12:18:18' WHERE storedetailid = '1481';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1456', '1', '3', '1', '305', 'اضافة فاتورة مبيعات', 'sellbillController.php', '198', '195', '2', '2026-10-09 12:18:18','0','0'); -- id=3969
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1753925',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1750445','3480', '0', '2', 'اضافة فاتورة مبيعات', '305', '1753925', '2026-10-09 12:18:18', '2',  'sellbillController.php','1','','0'); -- id=351
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3480', '3480', '2026-10-09', '2', '0', '0', '2026-10-09 12:18:18','اضافة فاتورة مبيعات رقم 305','1','0',null,'0','305','sellbillController.php?do=showDetail&sellbillid=305'); -- id=1742
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1742', '419', '3480', '','0'); -- id=1771
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1753925', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1742', '143', '3480', '','0'); -- id=1742
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3234665', 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 ( '3120', '3120', '2026-10-09', '2', '0', '0', '2026-10-09 12:18:18','اضافة فاتورة مبيعات رقم 305 - صرف البضاعة من المخزن','1','0',null,'0','305','sellbillController.php?do=showDetail&sellbillid=305'); -- id=1743
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1743', '402', '3120', '','0'); -- id=1772
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3041132.95', 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 ('1743', '382', '3120', '','0'); -- id=1743
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19971895.25', 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='1742,0,1743' where sellbillid=305;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 3480, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3480, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3480, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3480, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, 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, 3480, 3120, 3120
                    , 3120, 3120, 3120, 3120, 3120, 3120)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3480, netSellCostBuyPrice = netSellCostBuyPrice+3120
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3120
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3120
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3120
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3120
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3120
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3120
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3120;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8afec0f79c and sellbillId = 305 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 08:48:18";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:18:18", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:18:18', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5809
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:08:20";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:38:20", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:38:20', '6', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5810

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8af5e8d9d6
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8af5e8d9d6 and sellbillId = 306 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:08:20";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:38:20", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:38:20', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5811
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:13:49";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:43:49", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:43:49', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5812

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8aed479076
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 12:43:49', '06ac8aed479076', '1', '0.00', '0', '0', '1', '3300.00', '3300', '3300', '0', '2', '2026-10-09 12:43:49', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '6' ,'0','','','','','-1','0','0','0','0','0','3300','0','','0','0','3300','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=307
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','307', '0', '2026-10-09 12:43:49', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3300', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 12:43:49','0','0','',''); -- id=415
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 621;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('495','01722', '307', '49', '1722', '6', '550', '3300', '0', '', '0', '2026-10-09 12:43:49', '1722', '0.00', '0', '2','0.00','','','0','0','0','0','0','0','0','0','','621-6,','1','1','0','0','550','3300','0','','0','0.00','0','0','0','0'); -- id=1106
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 495.00, meanbuyprice_withDiscount = 495.00
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 495
                where sellbilldetailid = 1106;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1722, '2026-10-09', 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2970
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2970
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2970
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2970
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '57', userid = '4', storedetaildate = '2026-10-09 12:43:49' WHERE storedetailid = '2735';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1722', '2', '6', '1', '307', 'اضافة فاتورة مبيعات', 'sellbillController.php', '63', '57', '4', '2026-10-09 12:43:49','0','0'); -- id=3971
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '417650',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('414350','3300', '0', '3', 'اضافة فاتورة مبيعات', '307', '417650', '2026-10-09 12:43:49', '4',  'sellbillController.php','1','','0'); -- id=353
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3300', '3300', '2026-10-09', '4', '0', '0', '2026-10-09 12:43:49','اضافة فاتورة مبيعات رقم 307','1','0',null,'0','307','sellbillController.php?do=showDetail&sellbillid=307'); -- id=1746
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1746', '501', '3300', '','0'); -- id=1775
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '417650', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1746', '143', '3300', '','0'); -- id=1746
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3238460', 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 ( '2970', '2970', '2026-10-09', '4', '0', '0', '2026-10-09 12:43:49','اضافة فاتورة مبيعات رقم 307 - صرف البضاعة من المخزن','1','0',null,'0','307','sellbillController.php?do=showDetail&sellbillid=307'); -- id=1747
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1747', '402', '2970', '','0'); -- id=1776
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3044522.95', 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 ('1747', '492', '2970', '','0'); -- id=1747
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '752765', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1746,0,1747' where sellbillid=307;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2970
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2970
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2970
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2970
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, 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, 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970, 3300, 3300)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3300, netSellCostBuyPrice = netSellCostBuyPrice+3300
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3300
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3300
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2970
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2970
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2970
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3300
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3300;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8aed479076 and sellbillId = 307 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:13:50";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:43:50", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:43:50', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5813
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:14:36";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:14:36";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:14:38";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:44:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 12:44:38', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5814
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:14:39";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 12:44:39', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5815
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:14:43";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:44:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 12:44:43', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=5816
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:19:30";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:19:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:49:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 12:49:32', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5817
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:19:32";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 12:49:32', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5818
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:19:36";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:49:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 12:49:36', '1', 'showbarcode', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=5819
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:19:57";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:49:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:49:57', '1', 'bill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=5820
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:21:07";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:51:07", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:51:07', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5821

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8ab268dc6d
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 12:51:07', '06ac8ab268dc6d', '1', '0.00', '0', '0', '1', '70240.00', '70240', '70240', '0', '1', '2026-10-09 12:51:07', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '127' ,'0','','','','','-1','0','0','0','0','0','70240','0','','0','0','70240','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=308
UPDATE client SET  clientdebt = '0', userid = '3' 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','اضافة فاتورة مبيعات','308', '0', '2026-10-09 12:51:07', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '70240', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 12:51:07','0','0','',''); -- id=416
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 76;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('441','01384', '308', '95', '1384', '12', '490', '5880', '0', '', '0', '2026-10-09 12:51:07', '1384', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','76-12,','1','1','0','0','490','5880','0','','0','0.00','0','0','0','0'); -- id=1107
UPDATE sellbilldetail SET  lastbuyprice = 490.00 , meanbuyprice = 490.00, lastbuyprice_withDiscount = 441.00, meanbuyprice_withDiscount = 465.50
        , lastbuyprice_withTax = 490, meanbuyprice_withTax = 245, lastbuyprice_withDiscountAndTax = 441
                where sellbilldetailid = 1107;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1384, '2026-10-09', 5880, 5880, 5880
                    , 5880, 5292, 5586, 5292
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 5880, 2940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5880, sellCostBuyPrice =sellCostBuyPrice+5880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5292, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5586
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5292
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2940
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5880, 5880, 5880
                    , 5880, 5292, 5586, 5292
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5880, 2940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5880, sellCostBuyPrice =sellCostBuyPrice+5880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5292, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5586
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5292
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2940
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '267', userid = '3', storedetaildate = '2026-10-09 12:51:07' WHERE storedetailid = '1384';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1384', '1', '12', '1', '308', 'اضافة فاتورة مبيعات', 'sellbillController.php', '279', '267', '3', '2026-10-09 12:51:07','0','0'); -- id=3972
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 310;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('427.5','01532', '308', '111', '1532', '6', '475', '2850', '0', '', '0', '2026-10-09 12:51:07', '1532', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','310-6,','1','1','0','0','475','2850','0','','0','0.00','0','0','0','0'); -- id=1108
UPDATE sellbilldetail SET  lastbuyprice = 475.00 , meanbuyprice = 475.00, lastbuyprice_withDiscount = 427.50, meanbuyprice_withDiscount = 427.50
        , lastbuyprice_withTax = 475, meanbuyprice_withTax = 475, lastbuyprice_withDiscountAndTax = 427.5
                where sellbilldetailid = 1108;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1532, '2026-10-09', 2850, 2850, 2850
                    , 2850, 2565, 2565, 2565
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2850, sellCostBuyPrice =sellCostBuyPrice+2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2565, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2565
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2565
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2850, 2850, 2850
                    , 2850, 2565, 2565, 2565
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2850, sellCostBuyPrice =sellCostBuyPrice+2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2565, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2565
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2565
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '5', userid = '3', storedetaildate = '2026-10-09 12:51:07' WHERE storedetailid = '1557';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1532', '1', '6', '1', '308', 'اضافة فاتورة مبيعات', 'sellbillController.php', '11', '5', '3', '2026-10-09 12:51:07','0','0'); -- id=3973
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','01379', '308', '94', '1379', '12', '300', '3600', '0', '', '0', '2026-10-09 12:51:07', '1379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','71-12,','1','1','0','0','300','3600','0','','0','0.00','0','0','0','0'); -- id=1109
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1109;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-09', 3600, 3240, 3240
                    , 3240, 3240, 3240, 3240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3600, 3240, 3240
                    , 3240, 3240, 3240, 3240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '633', userid = '3', storedetaildate = '2026-10-09 12:51:07' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '12', '1', '308', 'اضافة فاتورة مبيعات', 'sellbillController.php', '645', '633', '3', '2026-10-09 12:51:07','0','0'); -- id=3974
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 74;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','01382', '308', '94', '1382', '6', '400', '2400', '0', '', '0', '2026-10-09 12:51:07', '1382', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','74-6,','1','1','0','0','400','2400','0','','0','0.00','0','0','0','0'); -- id=1110
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1110;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1382, '2026-10-09', 2400, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2400, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '78', userid = '3', storedetaildate = '2026-10-09 12:51:07' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '6', '1', '308', 'اضافة فاتورة مبيعات', 'sellbillController.php', '84', '78', '3', '2026-10-09 12:51:07','0','0'); -- id=3975
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+18 where id = 72;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01380', '308', '94', '1380', '18', '390', '7020', '0', '', '0', '2026-10-09 12:51:07', '1380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','72-18,','1','1','0','0','390','7020','0','','0','0.00','0','0','0','0'); -- id=1111
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1111;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-09', 7020, 6300, 6300
                    , 6300, 6300, 6300, 6300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 0, 6300, 6300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7020, sellCostBuyPrice =sellCostBuyPrice+6300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+18
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 7020, 6300, 6300
                    , 6300, 6300, 6300, 6300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6300, 6300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7020, sellCostBuyPrice =sellCostBuyPrice+6300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '606', userid = '3', storedetaildate = '2026-10-09 12:51:07' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '18', '1', '308', 'اضافة فاتورة مبيعات', 'sellbillController.php', '624', '606', '3', '2026-10-09 12:51:07','0','0'); -- id=3976
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 235;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01456', '308', '94', '1456', '12', '360', '4320', '0', '', '0', '2026-10-09 12:51:07', '1456', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','235-12,','1','1','0','0','360','4320','0','','0','0.00','0','0','0','0'); -- id=1112
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 1112;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1456, '2026-10-09', 4320, 3840, 3840
                    , 3840, 3840, 3840, 3840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3840, 3840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4320, sellCostBuyPrice =sellCostBuyPrice+3840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4320, 3840, 3840
                    , 3840, 3840, 3840, 3840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3840, 3840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4320, sellCostBuyPrice =sellCostBuyPrice+3840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '183', userid = '3', storedetaildate = '2026-10-09 12:51:07' WHERE storedetailid = '1481';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1456', '1', '12', '1', '308', 'اضافة فاتورة مبيعات', 'sellbillController.php', '195', '183', '3', '2026-10-09 12:51:07','0','0'); -- id=3977
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 354;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','01466', '308', '104', '1466', '12', '370', '4440', '0', '', '0', '2026-10-09 12:51:07', '1466', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','354-12,','1','1','0','0','370','4440','0','','0','0.00','0','0','0','0'); -- id=1113
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 1113;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1466, '2026-10-09', 4440, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4440, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4440, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4440, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '456', userid = '3', storedetaildate = '2026-10-09 12:51:07' WHERE storedetailid = '1491';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1466', '1', '12', '1', '308', 'اضافة فاتورة مبيعات', 'sellbillController.php', '468', '456', '3', '2026-10-09 12:51:07','0','0'); -- id=3978
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 70;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01378', '308', '94', '1378', '12', '360', '4320', '0', '', '0', '2026-10-09 12:51:07', '1378', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','70-12,','1','1','0','0','360','4320','0','','0','0.00','0','0','0','0'); -- id=1114
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 1114;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1378, '2026-10-09', 4320, 3840, 3840
                    , 3840, 3840, 3840, 3840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3840, 3840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4320, sellCostBuyPrice =sellCostBuyPrice+3840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4320, 3840, 3840
                    , 3840, 3840, 3840, 3840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3840, 3840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4320, sellCostBuyPrice =sellCostBuyPrice+3840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '612', userid = '3', storedetaildate = '2026-10-09 12:51:07' WHERE storedetailid = '1378';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1378', '1', '12', '1', '308', 'اضافة فاتورة مبيعات', 'sellbillController.php', '624', '612', '3', '2026-10-09 12:51:07','0','0'); -- id=3979
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 236;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1200','01475', '308', '106', '1475', '8', '1280', '10240', '0', '', '0', '2026-10-09 12:51:07', '1475', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','236-8,','1','1','0','0','1280','10240','0','','0','0.00','0','0','0','0'); -- id=1115
UPDATE sellbilldetail SET  lastbuyprice = 1200.00 , meanbuyprice = 1200.00, lastbuyprice_withDiscount = 1200.00, meanbuyprice_withDiscount = 1200.00
        , lastbuyprice_withTax = 1200, meanbuyprice_withTax = 1200, lastbuyprice_withDiscountAndTax = 1200
                where sellbilldetailid = 1115;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1475, '2026-10-09', 10240, 9600, 9600
                    , 9600, 9600, 9600, 9600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 9600, 9600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10240, sellCostBuyPrice =sellCostBuyPrice+9600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 10240, 9600, 9600
                    , 9600, 9600, 9600, 9600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9600, 9600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10240, sellCostBuyPrice =sellCostBuyPrice+9600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '40', userid = '3', storedetaildate = '2026-10-09 12:51:07' WHERE storedetailid = '1500';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1475', '1', '8', '1', '308', 'اضافة فاتورة مبيعات', 'sellbillController.php', '48', '40', '3', '2026-10-09 12:51:07','0','0'); -- id=3980
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 238;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1000','01476', '308', '106', '1476', '8', '1080', '8640', '0', '', '0', '2026-10-09 12:51:07', '1476', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','238-8,','1','1','0','0','1080','8640','0','','0','0.00','0','0','0','0'); -- id=1116
UPDATE sellbilldetail SET  lastbuyprice = 1000.00 , meanbuyprice = 1000.00, lastbuyprice_withDiscount = 1000.00, meanbuyprice_withDiscount = 1000.00
        , lastbuyprice_withTax = 1000, meanbuyprice_withTax = 500, lastbuyprice_withDiscountAndTax = 1000
                where sellbilldetailid = 1116;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1476, '2026-10-09', 8640, 8000, 8000
                    , 8000, 8000, 8000, 8000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 8000, 4000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8640, sellCostBuyPrice =sellCostBuyPrice+8000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 8640, 8000, 8000
                    , 8000, 8000, 8000, 8000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8000, 4000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8640, sellCostBuyPrice =sellCostBuyPrice+8000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '3', storedetaildate = '2026-10-09 12:51:07' WHERE storedetailid = '1501';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1476', '1', '8', '1', '308', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '16', '3', '2026-10-09 12:51:07','0','0'); -- id=3981
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 679;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('920','01765', '308', '137', '1765', '8', '990', '7920', '0', '', '0', '2026-10-09 12:51:07', '1765', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','679-8,','1','1','0','0','990','7920','0','','0','0.00','0','0','0','0'); -- id=1117
UPDATE sellbilldetail SET  lastbuyprice = 920.00 , meanbuyprice = 920.00, lastbuyprice_withDiscount = 920.00, meanbuyprice_withDiscount = 920.00
        , lastbuyprice_withTax = 920, meanbuyprice_withTax = 920, lastbuyprice_withDiscountAndTax = 920
                where sellbilldetailid = 1117;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1765, '2026-10-09', 7920, 7360, 7360
                    , 7360, 7360, 7360, 7360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 7360, 7360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7920, sellCostBuyPrice =sellCostBuyPrice+7360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 7920, 7360, 7360
                    , 7360, 7360, 7360, 7360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7360, 7360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7920, sellCostBuyPrice =sellCostBuyPrice+7360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '3', storedetaildate = '2026-10-09 12:51:07' WHERE storedetailid = '2778';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1765', '1', '8', '1', '308', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '16', '3', '2026-10-09 12:51:07','0','0'); -- id=3982
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 683;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('980','01769', '308', '137', '1769', '4', '1050', '4200', '0', '', '0', '2026-10-09 12:51:07', '1769', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','683-4,','1','1','0','0','1050','4200','0','','0','0.00','0','0','0','0'); -- id=1118
UPDATE sellbilldetail SET  lastbuyprice = 980.00 , meanbuyprice = 980.00, lastbuyprice_withDiscount = 980.00, meanbuyprice_withDiscount = 980.00
        , lastbuyprice_withTax = 980, meanbuyprice_withTax = 980, lastbuyprice_withDiscountAndTax = 980
                where sellbilldetailid = 1118;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1769, '2026-10-09', 4200, 3920, 3920
                    , 3920, 3920, 3920, 3920
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 3920, 3920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4200, sellCostBuyPrice =sellCostBuyPrice+3920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3920, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3920
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3920
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4200, 3920, 3920
                    , 3920, 3920, 3920, 3920
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3920, 3920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4200, sellCostBuyPrice =sellCostBuyPrice+3920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3920, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3920
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3920
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '3', storedetaildate = '2026-10-09 12:51:07' WHERE storedetailid = '2782';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1769', '1', '4', '1', '308', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '16', '3', '2026-10-09 12:51:07','0','0'); -- id=3983
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 543;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('441','01641', '308', '122', '1641', '9', '490', '4410', '0', '', '0', '2026-10-09 12:51:07', '1641', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','543-9,','1','1','0','0','490','4410','0','','0','0.00','0','0','0','0'); -- id=1119
UPDATE sellbilldetail SET  lastbuyprice = 490.00 , meanbuyprice = 490.00, lastbuyprice_withDiscount = 441.00, meanbuyprice_withDiscount = 441.00
        , lastbuyprice_withTax = 490, meanbuyprice_withTax = 490, lastbuyprice_withDiscountAndTax = 441
                where sellbilldetailid = 1119;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1641, '2026-10-09', 4410, 4410, 4410
                    , 4410, 3969, 3969, 3969
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4410, 4410, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4410, sellCostBuyPrice =sellCostBuyPrice+4410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3969, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3969
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3969
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4410
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4410
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4410, 4410, 4410
                    , 4410, 3969, 3969, 3969
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4410, 4410, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4410, sellCostBuyPrice =sellCostBuyPrice+4410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3969, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3969
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3969
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4410
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4410
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '3', storedetaildate = '2026-10-09 12:51:07' WHERE storedetailid = '1666';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1641', '1', '9', '1', '308', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '15', '3', '2026-10-09 12:51:07','0','0'); -- id=3984
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1824165',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1753925','70240', '0', '2', 'اضافة فاتورة مبيعات', '308', '1824165', '2026-10-09 12:51:07', '3',  'sellbillController.php','1','','0'); -- id=354
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '70240', '70240', '2026-10-09', '3', '0', '0', '2026-10-09 12:51:07','اضافة فاتورة مبيعات رقم 308','1','0',null,'0','308','sellbillController.php?do=showDetail&sellbillid=308'); -- id=1748
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1748', '419', '70240', '','0'); -- id=1777
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1824165', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1748', '143', '70240', '','0'); -- id=1748
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3308700', 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 ( '63686', '63686', '2026-10-09', '3', '0', '0', '2026-10-09 12:51:07','اضافة فاتورة مبيعات رقم 308 - صرف البضاعة من المخزن','1','0',null,'0','308','sellbillController.php?do=showDetail&sellbillid=308'); -- id=1749
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1749', '402', '63686', '','0'); -- id=1778
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3108208.95', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1749', '382', '63686', '','0'); -- id=1749
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19907789.25', 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='1748,0,1749' where sellbillid=308;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 70240, 65000, 65000
                    , 65000, 63686, 63980, 63686
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,65000, 58060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+70240, sellCostBuyPrice =sellCostBuyPrice+65000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+65000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+65000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+63686, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+63980
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+63686
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+65000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+58060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 70240, 65000, 65000
                    , 65000, 63686, 63980, 63686
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,65000, 58060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+70240, sellCostBuyPrice =sellCostBuyPrice+65000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+65000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+65000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+63686, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+63980
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+63686
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+65000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+58060
                        , returnSellVal = returnSellVal+0, 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, 70240, 65000, 65000
                    , 65000, 63686, 63980, 63686, 65000, 58060)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+70240, netSellCostBuyPrice = netSellCostBuyPrice+65000
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+65000
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+65000
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+63686
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+63980
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+63686
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+65000
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+58060;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8ab268dc6d and sellbillId = 308 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:21:08";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:51:08", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:51:08', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5822
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:21:10";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:51:10", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:51:10', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=308'); -- id=5823
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:23:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:53:32", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:53:32', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5824
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:23:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:53:32", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:53:32', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5825
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:25:53";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:25:55";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:55:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 12:55:55', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5826
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:25:55";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 12:55:55', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5827
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:25:58";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:55:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 12:55:58', '1', 'bill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=5828
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:26:04";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:56:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 12:56:04', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5829
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:28:21";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:58:21", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:58:21', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5830

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8b99cc8979
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 12:58:21', '06ac8b99cc8979', '1', '0.00', '0', '0', '1', '4620.00', '4620', '4620', '0', '1', '2026-10-09 12:58:21', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '12' ,'0','','','','','-1','0','0','0','0','0','4620','0','','0','0','4620','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=309
UPDATE client SET  clientdebt = '0', userid = '3' 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','اضافة فاتورة مبيعات','309', '0', '2026-10-09 12:58:21', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '4620', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 12:58:21','0','0','',''); -- id=417
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 330;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','01460', '309', '103', '1460', '9', '380', '3420', '0', '', '0', '2026-10-09 12:58:21', '1460', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','330-9,','1','1','0','0','380','3420','0','','0','0.00','0','0','0','0'); -- id=1120
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1120;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1460, '2026-10-09', 3420, 3240, 3240
                    , 3240, 3240, 3240, 3240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3420, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3420, 3240, 3240
                    , 3240, 3240, 3240, 3240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3420, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 12:58:21' WHERE storedetailid = '1485';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1460', '1', '9', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '18', '3', '2026-10-09 12:58:21','0','0'); -- id=3985
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 74;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','01382', '309', '94', '1382', '3', '400', '1200', '0', '', '0', '2026-10-09 12:58:21', '1382', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','74-3,','1','1','0','0','400','1200','0','','0','0.00','0','0','0','0'); -- id=1121
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1121;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1382, '2026-10-09', 1200, 1080, 1080
                    , 1080, 1080, 1080, 1080
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1200, 1080, 1080
                    , 1080, 1080, 1080, 1080
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '75', userid = '3', storedetaildate = '2026-10-09 12:58:21' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '3', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '78', '75', '3', '2026-10-09 12:58:21','0','0'); -- id=3986
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1828785',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1824165','4620', '0', '2', 'اضافة فاتورة مبيعات', '309', '1828785', '2026-10-09 12:58:21', '3',  'sellbillController.php','1','','0'); -- id=355
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4620', '4620', '2026-10-09', '3', '0', '0', '2026-10-09 12:58:21','اضافة فاتورة مبيعات رقم 309','1','0',null,'0','309','sellbillController.php?do=showDetail&sellbillid=309'); -- id=1750
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1750', '419', '4620', '','0'); -- id=1779
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1828785', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1750', '143', '4620', '','0'); -- id=1750
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3313320', 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 ( '4320', '4320', '2026-10-09', '3', '0', '0', '2026-10-09 12:58:21','اضافة فاتورة مبيعات رقم 309 - صرف البضاعة من المخزن','1','0',null,'0','309','sellbillController.php?do=showDetail&sellbillid=309'); -- id=1751
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1751', '402', '4320', '','0'); -- id=1780
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3112528.95', 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 ('1751', '382', '4320', '','0'); -- id=1751
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19903469.25', 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='1750,0,1751' where sellbillid=309;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 4620, 4320, 4320
                    , 4320, 4320, 4320, 4320
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4320, 4320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4620, sellCostBuyPrice =sellCostBuyPrice+4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4320
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4620, 4320, 4320
                    , 4320, 4320, 4320, 4320
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4320, 4320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4620, sellCostBuyPrice =sellCostBuyPrice+4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4320
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4320
                        , returnSellVal = returnSellVal+0, 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, 4620, 4320, 4320
                    , 4320, 4320, 4320, 4320, 4320, 4320)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+4620, netSellCostBuyPrice = netSellCostBuyPrice+4320
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+4320
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+4320
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+4320
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+4320
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+4320
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+4320
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+4320;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8b99cc8979 and sellbillId = 309 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:28:21";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:58:21", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:58:21', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5831
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:28:24";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:58:24", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:58:24', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=309'); -- id=5832
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:28:24";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:58:24", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:58:24', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=309'); -- id=5833
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:28:26";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:58:26", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:58:26', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5834

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8b15aa9bc3
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 12:58:26', '06ac8b15aa9bc3', '1', '0.00', '0', '5', '1', '11145.00', '11140', '11140', '0', '1', '2026-10-09 12:58:26', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '30' ,'0','','','','','-1','0','0','0','0','0','11140','0','','0','0','11140','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=310
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','310', '0', '2026-10-09 12:58:26', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '11140', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 12:58:26','0','0','',''); -- id=418
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 558;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('322','01694', '310', '127', '1694', '6', '350', '2100', '0', '', '0', '2026-10-09 12:58:26', '1694', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','558-6,','1','1','0','0','350','2100','0','','0','0.00','0','0','0','0'); -- id=1122
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 322.00, meanbuyprice_withDiscount = 322.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 322
                where sellbilldetailid = 1122;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1694, '2026-10-09', 2099.0578734859, 2100, 2100
                    , 2100, 1932, 1932, 1932
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2099.0578734859, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1932, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1932
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1932
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2099.0578734859, 2100, 2100
                    , 2100, 1932, 1932, 1932
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2099.0578734859, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1932, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1932
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1932
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '2', storedetaildate = '2026-10-09 12:58:26' WHERE storedetailid = '2706';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1694', '1', '6', '1', '310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '15', '2', '2026-10-09 12:58:26','0','0'); -- id=3987
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 559;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('386.4','01695', '310', '127', '1695', '9', '420', '3780', '0', '', '0', '2026-10-09 12:58:26', '1695', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','559-9,','1','1','0','0','420','3780','0','','0','0.00','0','0','0','0'); -- id=1123
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 420.00, lastbuyprice_withDiscount = 386.40, meanbuyprice_withDiscount = 386.40
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 386.4
                where sellbilldetailid = 1123;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1695, '2026-10-09', 3778.3041722746, 3780, 3780
                    , 3780, 3477.6, 3477.6, 3477.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3780, 3780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3778.3041722746, sellCostBuyPrice =sellCostBuyPrice+3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3477.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3477.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3477.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3778.3041722746, 3780, 3780
                    , 3780, 3477.6, 3477.6, 3477.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3780, 3780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3778.3041722746, sellCostBuyPrice =sellCostBuyPrice+3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3477.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3477.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3477.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '159', userid = '2', storedetaildate = '2026-10-09 12:58:26' WHERE storedetailid = '2707';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1695', '1', '9', '1', '310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '168', '159', '2', '2026-10-09 12:58:26','0','0'); -- id=3988
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 516;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('437','01667', '310', '124', '1667', '3', '475', '1425', '0', '', '0', '2026-10-09 12:58:26', '1667', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','516-3,','1','1','0','0','475','1425','0','','0','0.00','0','0','0','0'); -- id=1124
UPDATE sellbilldetail SET  lastbuyprice = 475.00 , meanbuyprice = 475.00, lastbuyprice_withDiscount = 437.00, meanbuyprice_withDiscount = 437.00
        , lastbuyprice_withTax = 475, meanbuyprice_withTax = 475, lastbuyprice_withDiscountAndTax = 437
                where sellbilldetailid = 1124;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1667, '2026-10-09', 1424.3606998654, 1425, 1425
                    , 1425, 1311, 1311, 1311
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1425, 1425, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1424.3606998654, sellCostBuyPrice =sellCostBuyPrice+1425
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1425, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1425
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1311, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1311
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1311
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1425
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1425
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1424.3606998654, 1425, 1425
                    , 1425, 1311, 1311, 1311
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1425, 1425, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1424.3606998654, sellCostBuyPrice =sellCostBuyPrice+1425
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1425, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1425
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1311, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1311
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1311
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1425
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1425
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '6', userid = '2', storedetaildate = '2026-10-09 12:58:26' WHERE storedetailid = '2679';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1667', '1', '3', '1', '310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '6', '2', '2026-10-09 12:58:26','0','0'); -- id=3989
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 656;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','01743', '310', '134', '1743', '12', '320', '3840', '0', '', '0', '2026-10-09 12:58:26', '1743', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','656-12,','1','1','0','0','320','3840','0','','0','0.00','0','0','0','0'); -- id=1125
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 1125;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1743, '2026-10-09', 3838.2772543742, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3838.2772543742, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3838.2772543742, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3838.2772543742, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '40', userid = '2', storedetaildate = '2026-10-09 12:58:26' WHERE storedetailid = '2756';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1743', '1', '12', '1', '310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '52', '40', '2', '2026-10-09 12:58:26','0','0'); -- id=3990
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1839925',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1828785','11140', '0', '2', 'اضافة فاتورة مبيعات', '310', '1839925', '2026-10-09 12:58:26', '2',  'sellbillController.php','1','','0'); -- id=356
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '11145', '11145', '2026-10-09', '2', '0', '0', '2026-10-09 12:58:26','اضافة فاتورة مبيعات رقم 310','1','0',null,'0','310','sellbillController.php?do=showDetail&sellbillid=310'); -- id=1752
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1752', '419', '11140', '','0'); -- id=1781
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1839925', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1752', '398', '5', '','0'); -- id=1782
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '137448', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1752', '143', '11145', '','0'); -- id=1752
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3324465', 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 ( '10320.6', '10320.6', '2026-10-09', '2', '0', '0', '2026-10-09 12:58:26','اضافة فاتورة مبيعات رقم 310 - صرف البضاعة من المخزن','1','0',null,'0','310','sellbillController.php?do=showDetail&sellbillid=310'); -- id=1753
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1753', '402', '10320.6', '','0'); -- id=1783
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3122849.55', 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 ('1753', '382', '10320.6', '','0'); -- id=1753
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19893148.65', 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='1752,0,1753' where sellbillid=310;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 11140, 10905, 10905
                    , 10905, 10320.6, 10320.6, 10320.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10905, 10905, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11140, sellCostBuyPrice =sellCostBuyPrice+10905
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10905, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10905
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10320.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10320.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10320.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10905
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10905
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 11140, 10905, 10905
                    , 10905, 10320.6, 10320.6, 10320.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10905, 10905, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11140, sellCostBuyPrice =sellCostBuyPrice+10905
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10905, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10905
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10320.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10320.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10320.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10905
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10905
                        , returnSellVal = returnSellVal+0, 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, 11140, 10905, 10905
                    , 10905, 10320.6, 10320.6, 10320.6, 10905, 10905)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+11140, netSellCostBuyPrice = netSellCostBuyPrice+10905
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+10905
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+10905
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+10320.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+10320.6
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+10320.6
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+10905
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+10905;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8b15aa9bc3 and sellbillId = 310 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:28:26";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:58:26", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:58:26', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5835
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:29:14";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:59:14", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:59:14', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5836
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:29:14";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:59:14", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:59:14', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5837
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:29:54";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:59:54", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:59:54', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5838

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8bac2a980f
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 12:59:54', '06ac8bac2a980f', '1', '0.00', '0', '0', '1', '2740.00', '2740', '2740', '0', '1', '2026-10-09 12:59:54', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '8' ,'0','','','','','-1','0','0','0','0','0','2740','0','','0','0','2740','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=311
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','311', '0', '2026-10-09 12:59:54', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2740', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 12:59:54','0','0','',''); -- id=419
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 274;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('342','01468', '311', '105', '1468', '3', '380', '1140', '0', '', '0', '2026-10-09 12:59:54', '1468', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','274-3,','1','1','0','0','380','1140','0','','0','0.00','0','0','0','0'); -- id=1126
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 342.00, meanbuyprice_withDiscount = 342.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 342
                where sellbilldetailid = 1126;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1468, '2026-10-09', 1140, 1140, 1140
                    , 1140, 1026, 1026, 1026
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1140, 1140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1140, sellCostBuyPrice =sellCostBuyPrice+1140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1026, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1026
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1026
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1140
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1140, 1140, 1140
                    , 1140, 1026, 1026, 1026
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1140, 1140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1140, sellCostBuyPrice =sellCostBuyPrice+1140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1026, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1026
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1026
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1140
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '99', userid = '2', storedetaildate = '2026-10-09 12:59:54' WHERE storedetailid = '1493';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1468', '1', '3', '1', '311', 'اضافة فاتورة مبيعات', 'sellbillController.php', '102', '99', '2', '2026-10-09 12:59:54','0','0'); -- id=3991
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','09694', '311', '40', '1134', '5', '320', '1600', '0', '', '0', '2026-10-09 12:59:54', '1134', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','320','1600','0','','0','0.00','0','0','0','0'); -- id=1127
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 1127;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1134, '2026-10-09', 1600, 1500, 1500
                    , 1500, 1500, 1500, 1500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1500, 1500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1600, sellCostBuyPrice =sellCostBuyPrice+1500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1600, 1500, 1500
                    , 1500, 1500, 1500, 1500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1500, 1500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1600, sellCostBuyPrice =sellCostBuyPrice+1500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '202', userid = '2', storedetaildate = '2026-10-09 12:59:54' WHERE storedetailid = '1134';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1134', '1', '5', '1', '311', 'اضافة فاتورة مبيعات', 'sellbillController.php', '207', '202', '2', '2026-10-09 12:59:54','0','0'); -- id=3992
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1842665',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1839925','2740', '0', '2', 'اضافة فاتورة مبيعات', '311', '1842665', '2026-10-09 12:59:54', '2',  'sellbillController.php','1','','0'); -- id=357
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2740', '2740', '2026-10-09', '2', '0', '0', '2026-10-09 12:59:54','اضافة فاتورة مبيعات رقم 311','1','0',null,'0','311','sellbillController.php?do=showDetail&sellbillid=311'); -- id=1754
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1754', '419', '2740', '','0'); -- id=1784
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1842665', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1754', '143', '2740', '','0'); -- id=1754
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3327205', 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 ( '2526', '2526', '2026-10-09', '2', '0', '0', '2026-10-09 12:59:54','اضافة فاتورة مبيعات رقم 311 - صرف البضاعة من المخزن','1','0',null,'0','311','sellbillController.php?do=showDetail&sellbillid=311'); -- id=1755
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1755', '402', '2526', '','0'); -- id=1785
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3125375.55', 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 ('1755', '382', '2526', '','0'); -- id=1755
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19890622.65', 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='1754,0,1755' where sellbillid=311;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 2740, 2640, 2640
                    , 2640, 2526, 2526, 2526
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2640, 2640, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2740, sellCostBuyPrice =sellCostBuyPrice+2640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2526, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2526
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2526
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2640
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2740, 2640, 2640
                    , 2640, 2526, 2526, 2526
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2640, 2640, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2740, sellCostBuyPrice =sellCostBuyPrice+2640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2526, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2526
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2526
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2640
                        , returnSellVal = returnSellVal+0, 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, 2740, 2640, 2640
                    , 2640, 2526, 2526, 2526, 2640, 2640)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2740, netSellCostBuyPrice = netSellCostBuyPrice+2640
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2640
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2640
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2526
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2526
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2526
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2640
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2640;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8bac2a980f and sellbillId = 311 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:29:54";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 12:59:54", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 12:59:54', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5839
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:31:37";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:01:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-09 13:01:37', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=5840
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:31:53";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:01:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-09 13:01:53', '1', 'add2', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=add2'); -- id=5841
INSERT INTO productcat (productCatName, productCatDate, productCatDescription, productCatParent, userId, conditions, selldiscount, buydiscount, discounttype,isOptic , buytotal , buyhalf , buypart ,buypricereal,opticServices,logo,inMenu,stopNegativeSale,catExcelid,webApiId,obygyInvestigationCatId,price4,price5,price6,price7,price8,price9,price10,price11,price12,price13) VALUES ('كينج براند','2026-10-09','','93', '1','0', '0', '0', '-1', '0', '0', '0', '0','0','','.','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'); -- id=138
INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES (138, 1,'2026-10-09 13:01:53',1)
                ON DUPLICATE KEY UPDATE catid = 138, edited = 1, sysdate = '2026-10-09 13:01:53', userid = 1; -- id=150
INSERT INTO productcatunit (unitid, productcatid, productnumber, productcatunitdate, userid, conditions) VALUES ('1', '138', '1', '2026-10-09', '1', '0'); -- id=53
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:31:54";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:01:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-09 13:01:54', '1', 'sucess', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=sucess'); -- id=5842
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:31:55";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:01:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-09 13:01:55', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=show'); -- id=5843
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:31:58";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:01:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 13:01:58', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=5844
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:32:00";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:02:00", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:02:00', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5845

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8b7560f05e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 13:02:00', '06ac8b7560f05e', '1', '0.00', '0', '0', '1', '2520.00', '2520', '2520', '0', '2', '2026-10-09 13:02:00', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '6' ,'0','','','','','-1','0','0','0','0','0','2520','0','','0','0','2520','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=312
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','312', '0', '2026-10-09 13:02:00', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2520', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 13:02:00','0','0','',''); -- id=420
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 135;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('380','01326', '312', '87', '1326', '6', '420', '2520', '0', '', '0', '2026-10-09 13:02:00', '1326', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','135-6,','1','1','0','0','420','2520','0','','0','0.00','0','0','0','0'); -- id=1128
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 1128;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1326, '2026-10-09', 2520, 2280, 2280
                    , 2280, 2280, 2280, 2280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2280, 2280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 2520, 2280, 2280
                    , 2280, 2280, 2280, 2280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2280, 2280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '159', userid = '4', storedetaildate = '2026-10-09 13:02:00' WHERE storedetailid = '1407';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1326', '2', '6', '1', '312', 'اضافة فاتورة مبيعات', 'sellbillController.php', '165', '159', '4', '2026-10-09 13:02:00','0','0'); -- id=3993
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '420170',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('417650','2520', '0', '3', 'اضافة فاتورة مبيعات', '312', '420170', '2026-10-09 13:02:00', '4',  'sellbillController.php','1','','0'); -- id=358
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2520', '2520', '2026-10-09', '4', '0', '0', '2026-10-09 13:02:00','اضافة فاتورة مبيعات رقم 312','1','0',null,'0','312','sellbillController.php?do=showDetail&sellbillid=312'); -- id=1756
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1756', '501', '2520', '','0'); -- id=1786
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '420170', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1756', '143', '2520', '','0'); -- id=1756
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3329725', 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 ( '2280', '2280', '2026-10-09', '4', '0', '0', '2026-10-09 13:02:00','اضافة فاتورة مبيعات رقم 312 - صرف البضاعة من المخزن','1','0',null,'0','312','sellbillController.php?do=showDetail&sellbillid=312'); -- id=1757
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1757', '402', '2280', '','0'); -- id=1787
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3127655.55', 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 ('1757', '492', '2280', '','0'); -- id=1757
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '750485', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1756,0,1757' where sellbillid=312;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 2520, 2280, 2280
                    , 2280, 2280, 2280, 2280
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2280, 2280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2520, 2280, 2280
                    , 2280, 2280, 2280, 2280
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2280, 2280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2280
                        , returnSellVal = returnSellVal+0, 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, 2520, 2280, 2280
                    , 2280, 2280, 2280, 2280, 2280, 2280)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2520, netSellCostBuyPrice = netSellCostBuyPrice+2280
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2280
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2280
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2280
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2280
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2280
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2280
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2280;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8b7560f05e and sellbillId = 312 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:32:01";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:02:01", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:02:01', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5846
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:33:20";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:03:20", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:03:20', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5847

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8bb1ac201f
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 13:03:20', '06ac8bb1ac201f', '1', '0.00', '0', '0', '1', '5730.00', '5730', '5730', '0', '1', '2026-10-09 13:03:20', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '27' ,'0','','','','','-1','0','0','0','0','0','5730','0','','0','0','5730','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=313
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','313', '0', '2026-10-09 13:03:20', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '5730', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 13:03:20','0','0','',''); -- id=421
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 200;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('207','01451', '313', '101', '1451', '6', '230', '1380', '0', '', '0', '2026-10-09 13:03:20', '1451', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','200-6,','1','1','0','0','230','1380','0','','0','0.00','0','0','0','0'); -- id=1129
UPDATE sellbilldetail SET  lastbuyprice = 230.00 , meanbuyprice = 230.00, lastbuyprice_withDiscount = 207.00, meanbuyprice_withDiscount = 207.00
        , lastbuyprice_withTax = 230, meanbuyprice_withTax = 230, lastbuyprice_withDiscountAndTax = 207
                where sellbilldetailid = 1129;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1451, '2026-10-09', 1380, 1380, 1380
                    , 1380, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1380, 1380, 1380
                    , 1380, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '2', storedetaildate = '2026-10-09 13:03:20' WHERE storedetailid = '1468';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1451', '1', '6', '1', '313', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '21', '2', '2026-10-09 13:03:20','0','0'); -- id=3994
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 201;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('216','01452', '313', '101', '1452', '6', '240', '1440', '0', '', '0', '2026-10-09 13:03:20', '1452', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','201-6,','1','1','0','0','240','1440','0','','0','0.00','0','0','0','0'); -- id=1130
UPDATE sellbilldetail SET  lastbuyprice = 240.00 , meanbuyprice = 240.00, lastbuyprice_withDiscount = 216.00, meanbuyprice_withDiscount = 216.00
        , lastbuyprice_withTax = 240, meanbuyprice_withTax = 240, lastbuyprice_withDiscountAndTax = 216
                where sellbilldetailid = 1130;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1452, '2026-10-09', 1440, 1440, 1440
                    , 1440, 1296, 1296, 1296
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1440, 1440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1296, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1296
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1296
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1440, 1440, 1440
                    , 1440, 1296, 1296, 1296
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1440, 1440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1296, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1296
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1296
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '2', storedetaildate = '2026-10-09 13:03:20' WHERE storedetailid = '1469';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1452', '1', '6', '1', '313', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '15', '2', '2026-10-09 13:03:20','0','0'); -- id=3995
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 199;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('180','01450', '313', '101', '1450', '9', '200', '1800', '0', '', '0', '2026-10-09 13:03:20', '1450', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','199-9,','1','1','0','0','200','1800','0','','0','0.00','0','0','0','0'); -- id=1131
UPDATE sellbilldetail SET  lastbuyprice = 200.00 , meanbuyprice = 200.00, lastbuyprice_withDiscount = 180.00, meanbuyprice_withDiscount = 180.00
        , lastbuyprice_withTax = 200, meanbuyprice_withTax = 200, lastbuyprice_withDiscountAndTax = 180
                where sellbilldetailid = 1131;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1450, '2026-10-09', 1800, 1800, 1800
                    , 1800, 1620, 1620, 1620
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1800, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1620, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1620
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1620
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1800, 1800, 1800
                    , 1800, 1620, 1620, 1620
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1800, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1620, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1620
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1620
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-09 13:03:20' WHERE storedetailid = '1467';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1450', '1', '9', '1', '313', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '24', '2', '2026-10-09 13:03:20','0','0'); -- id=3996
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 198;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('166.5','01449', '313', '101', '1449', '6', '185', '1110', '0', '', '0', '2026-10-09 13:03:20', '1449', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','198-6,','1','1','0','0','185','1110','0','','0','0.00','0','0','0','0'); -- id=1132
UPDATE sellbilldetail SET  lastbuyprice = 185.00 , meanbuyprice = 185.00, lastbuyprice_withDiscount = 166.50, meanbuyprice_withDiscount = 166.50
        , lastbuyprice_withTax = 185, meanbuyprice_withTax = 185, lastbuyprice_withDiscountAndTax = 166.5
                where sellbilldetailid = 1132;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1449, '2026-10-09', 1110, 1110, 1110
                    , 1110, 999, 999, 999
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1110, 1110, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1110, sellCostBuyPrice =sellCostBuyPrice+1110
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1110, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1110
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+999, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+999
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+999
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1110
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1110
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1110, 1110, 1110
                    , 1110, 999, 999, 999
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1110, 1110, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1110, sellCostBuyPrice =sellCostBuyPrice+1110
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1110, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1110
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+999, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+999
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+999
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1110
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1110
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '102', userid = '2', storedetaildate = '2026-10-09 13:03:20' WHERE storedetailid = '1466';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1449', '1', '6', '1', '313', 'اضافة فاتورة مبيعات', 'sellbillController.php', '108', '102', '2', '2026-10-09 13:03:20','0','0'); -- id=3997
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1848395',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1842665','5730', '0', '2', 'اضافة فاتورة مبيعات', '313', '1848395', '2026-10-09 13:03:20', '2',  'sellbillController.php','1','','0'); -- id=359
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5730', '5730', '2026-10-09', '2', '0', '0', '2026-10-09 13:03:20','اضافة فاتورة مبيعات رقم 313','1','0',null,'0','313','sellbillController.php?do=showDetail&sellbillid=313'); -- id=1758
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1758', '419', '5730', '','0'); -- id=1788
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1848395', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1758', '143', '5730', '','0'); -- id=1758
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3335455', 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 ( '5157', '5157', '2026-10-09', '2', '0', '0', '2026-10-09 13:03:20','اضافة فاتورة مبيعات رقم 313 - صرف البضاعة من المخزن','1','0',null,'0','313','sellbillController.php?do=showDetail&sellbillid=313'); -- id=1759
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1759', '402', '5157', '','0'); -- id=1789
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3132812.55', 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 ('1759', '382', '5157', '','0'); -- id=1759
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19885465.65', 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='1758,0,1759' where sellbillid=313;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 5730, 5730, 5730
                    , 5730, 5157, 5157, 5157
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5730, 5730, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5730, sellCostBuyPrice =sellCostBuyPrice+5730
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5730, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5730
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5157, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5157
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5157
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5730
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5730
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5730, 5730, 5730
                    , 5730, 5157, 5157, 5157
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5730, 5730, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5730, sellCostBuyPrice =sellCostBuyPrice+5730
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5730, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5730
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5157, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5157
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5157
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5730
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5730
                        , returnSellVal = returnSellVal+0, 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, 5730, 5730, 5730
                    , 5730, 5157, 5157, 5157, 5730, 5730)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5730, netSellCostBuyPrice = netSellCostBuyPrice+5730
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5730
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5730
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5157
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5157
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5157
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5730
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5730;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8bb1ac201f and sellbillId = 313 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:33:20";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:03:20", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:03:20', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5848
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:34:49";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:04:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 13:04:49', '1', 'add', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=5849
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 ('موديل 1 كينج براند','','138','390','420','420','420','2026-10-09','0','1','0','','0','0','0','0','0','390','390','390','390','390','0','7.69','0','0','.','0','0','0','390','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','390','390','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','390','0','0','0','0','0','0','','','0','0','0','0'); -- id=1782
UPDATE product SET productName = 'موديل 1 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '390', productSellAllPrice = '420', productSellUnitPrice = '420', productSellHalfPrice = '420', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01782',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '390',lastbuyprice_withDiscount = '390',meanbuyprice = '390',meanbuyprice_withDiscount = '390' , productbuypricereal = '390' , buypricereal_precentage = '0' , buytotal_precentage = '7.69' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='390',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='390',meanbuyprice_withTax='390',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='390',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1782';
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', '1782', '1.00', '2026-10-09', '1', '0','0178201','420','420','420','390','','0','0','0','0','0','0','0','0','0','0'); -- id=1782
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1782', '1', '0', '1', '2026-10-09'); -- id=2795
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1782', '1', '0', '0', '1782', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=3998
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1782, 1,'2026-10-09 13:04:49',1)
                ON DUPLICATE KEY UPDATE productid = 1782, edited = 1, sysdate = '2026-10-09 13:04:49', userid = 1; -- id=2699
UPDATE product SET productName = 'موديل 1 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '390.00', productSellAllPrice = '420.00', productSellUnitPrice = '420.00', productSellHalfPrice = '420.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01782',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '390',lastbuyprice_withDiscount = '390',meanbuyprice = '390',meanbuyprice_withDiscount = '390' , productbuypricereal = '390' , buypricereal_precentage = '0' , buytotal_precentage = '7.69' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='390',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='390',meanbuyprice_withTax='390',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='390',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1782';
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 ('موديل 2 كينج براند','','138','350','380','380','380','2026-10-09','0','1','0','','0','0','0','0','0','350','350','350','350','350','0','8.57','0','0','.','0','0','0','350','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','350','350','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','350','0','0','0','0','0','0','','','0','0','0','0'); -- id=1783
UPDATE product SET productName = 'موديل 2 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '350', productSellAllPrice = '380', productSellUnitPrice = '380', productSellHalfPrice = '380', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01783',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '8.57' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',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='350',meanbuyprice_withTax='350',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='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1783';
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', '1783', '1.00', '2026-10-09', '1', '0','0178301','380','380','380','350','','0','0','0','0','0','0','0','0','0','0'); -- id=1783
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1783', '1', '0', '1', '2026-10-09'); -- id=2796
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1783', '1', '0', '0', '1783', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=3999
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1783, 1,'2026-10-09 13:04:49',1)
                ON DUPLICATE KEY UPDATE productid = 1783, edited = 1, sysdate = '2026-10-09 13:04:49', userid = 1; -- id=2700
UPDATE product SET productName = 'موديل 2 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '350.00', productSellAllPrice = '380.00', productSellUnitPrice = '380.00', productSellHalfPrice = '380.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01783',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '8.57' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',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='350',meanbuyprice_withTax='350',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='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1783';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 3 كينج براند','','138','350','380','380','380','2026-10-09','0','1','0','','0','0','0','0','0','350','350','350','350','350','0','8.57','0','0','.','0','0','0','350','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','350','350','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','350','0','0','0','0','0','0','','','0','0','0','0'); -- id=1784
UPDATE product SET productName = 'موديل 3 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '350', productSellAllPrice = '380', productSellUnitPrice = '380', productSellHalfPrice = '380', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01784',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '8.57' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',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='350',meanbuyprice_withTax='350',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='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1784';
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', '1784', '1.00', '2026-10-09', '1', '0','0178401','380','380','380','350','','0','0','0','0','0','0','0','0','0','0'); -- id=1784
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1784', '1', '0', '1', '2026-10-09'); -- id=2797
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1784', '1', '0', '0', '1784', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4000
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1784, 1,'2026-10-09 13:04:49',1)
                ON DUPLICATE KEY UPDATE productid = 1784, edited = 1, sysdate = '2026-10-09 13:04:49', userid = 1; -- id=2701
UPDATE product SET productName = 'موديل 3 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '350.00', productSellAllPrice = '380.00', productSellUnitPrice = '380.00', productSellHalfPrice = '380.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01784',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '8.57' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',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='350',meanbuyprice_withTax='350',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='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1784';
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 ('موديل 4 كينج براند','','138','400','430','430','430','2026-10-09','0','1','0','','0','0','0','0','0','400','400','400','400','400','0','7.5','0','0','.','0','0','0','400','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','400','400','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','400','0','0','0','0','0','0','','','0','0','0','0'); -- id=1785
UPDATE product SET productName = 'موديل 4 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '400', productSellAllPrice = '430', productSellUnitPrice = '430', productSellHalfPrice = '430', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01785',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '400',lastbuyprice_withDiscount = '400',meanbuyprice = '400',meanbuyprice_withDiscount = '400' , productbuypricereal = '400' , buypricereal_precentage = '0' , buytotal_precentage = '7.5' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='400',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='400',meanbuyprice_withTax='400',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='400',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1785';
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', '1785', '1.00', '2026-10-09', '1', '0','0178501','430','430','430','400','','0','0','0','0','0','0','0','0','0','0'); -- id=1785
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1785', '1', '0', '1', '2026-10-09'); -- id=2798
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1785', '1', '0', '0', '1785', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4001
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1785, 1,'2026-10-09 13:04:49',1)
                ON DUPLICATE KEY UPDATE productid = 1785, edited = 1, sysdate = '2026-10-09 13:04:49', userid = 1; -- id=2702
UPDATE product SET productName = 'موديل 4 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '400.00', productSellAllPrice = '430.00', productSellUnitPrice = '430.00', productSellHalfPrice = '430.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01785',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '400',lastbuyprice_withDiscount = '400',meanbuyprice = '400',meanbuyprice_withDiscount = '400' , productbuypricereal = '400' , buypricereal_precentage = '0' , buytotal_precentage = '7.5' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='400',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='400',meanbuyprice_withTax='400',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='400',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1785';
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 ('موديل 5 كينج براند','','138','440','470','470','470','2026-10-09','0','1','0','','0','0','0','0','0','440','440','440','440','440','0','6.82','0','0','.','0','0','0','440','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','440','440','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','440','0','0','0','0','0','0','','','0','0','0','0'); -- id=1786
UPDATE product SET productName = 'موديل 5 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '440', productSellAllPrice = '470', productSellUnitPrice = '470', productSellHalfPrice = '470', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01786',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440' , buypricereal_precentage = '0' , buytotal_precentage = '6.82' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',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='440',meanbuyprice_withTax='440',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='440',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1786';
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', '1786', '1.00', '2026-10-09', '1', '0','0178601','470','470','470','440','','0','0','0','0','0','0','0','0','0','0'); -- id=1786
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1786', '1', '0', '1', '2026-10-09'); -- id=2799
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1786', '1', '0', '0', '1786', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4002
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1786, 1,'2026-10-09 13:04:49',1)
                ON DUPLICATE KEY UPDATE productid = 1786, edited = 1, sysdate = '2026-10-09 13:04:49', userid = 1; -- id=2703
UPDATE product SET productName = 'موديل 5 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '440.00', productSellAllPrice = '470.00', productSellUnitPrice = '470.00', productSellHalfPrice = '470.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01786',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440' , buypricereal_precentage = '0' , buytotal_precentage = '6.82' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',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='440',meanbuyprice_withTax='440',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='440',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1786';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 6 كينج براند','','138','410','440','440','440','2026-10-09','0','1','0','','0','0','0','0','0','410','410','410','410','410','0','7.32','0','0','.','0','0','0','410','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','410','410','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','410','0','0','0','0','0','0','','','0','0','0','0'); -- id=1787
UPDATE product SET productName = 'موديل 6 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '410', productSellAllPrice = '440', productSellUnitPrice = '440', productSellHalfPrice = '440', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01787',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410',lastbuyprice_withDiscount = '410',meanbuyprice = '410',meanbuyprice_withDiscount = '410' , productbuypricereal = '410' , buypricereal_precentage = '0' , buytotal_precentage = '7.32' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',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='410',meanbuyprice_withTax='410',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='410',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1787';
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', '1787', '1.00', '2026-10-09', '1', '0','0178701','440','440','440','410','','0','0','0','0','0','0','0','0','0','0'); -- id=1787
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1787', '1', '0', '1', '2026-10-09'); -- id=2800
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1787', '1', '0', '0', '1787', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4003
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1787, 1,'2026-10-09 13:04:49',1)
                ON DUPLICATE KEY UPDATE productid = 1787, edited = 1, sysdate = '2026-10-09 13:04:49', userid = 1; -- id=2704
UPDATE product SET productName = 'موديل 6 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '410.00', productSellAllPrice = '440.00', productSellUnitPrice = '440.00', productSellHalfPrice = '440.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01787',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410',lastbuyprice_withDiscount = '410',meanbuyprice = '410',meanbuyprice_withDiscount = '410' , productbuypricereal = '410' , buypricereal_precentage = '0' , buytotal_precentage = '7.32' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',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='410',meanbuyprice_withTax='410',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='410',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1787';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 7 كينج براند','','138','345','375','375','375','2026-10-09','0','1','0','','0','0','0','0','0','345','345','345','345','345','0','8.7','0','0','.','0','0','0','345','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','345','345','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','345','0','0','0','0','0','0','','','0','0','0','0'); -- id=1788
UPDATE product SET productName = 'موديل 7 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '345', productSellAllPrice = '375', productSellUnitPrice = '375', productSellHalfPrice = '375', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01788',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '345',lastbuyprice_withDiscount = '345',meanbuyprice = '345',meanbuyprice_withDiscount = '345' , productbuypricereal = '345' , buypricereal_precentage = '0' , buytotal_precentage = '8.7' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='345',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='345',meanbuyprice_withTax='345',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='345',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1788';
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', '1788', '1.00', '2026-10-09', '1', '0','0178801','375','375','375','345','','0','0','0','0','0','0','0','0','0','0'); -- id=1788
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1788', '1', '0', '1', '2026-10-09'); -- id=2801
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1788', '1', '0', '0', '1788', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4004
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1788, 1,'2026-10-09 13:04:49',1)
                ON DUPLICATE KEY UPDATE productid = 1788, edited = 1, sysdate = '2026-10-09 13:04:49', userid = 1; -- id=2705
UPDATE product SET productName = 'موديل 7 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '345.00', productSellAllPrice = '375.00', productSellUnitPrice = '375.00', productSellHalfPrice = '375.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01788',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '345',lastbuyprice_withDiscount = '345',meanbuyprice = '345',meanbuyprice_withDiscount = '345' , productbuypricereal = '345' , buypricereal_precentage = '0' , buytotal_precentage = '8.7' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='345',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='345',meanbuyprice_withTax='345',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='345',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1788';
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 ('موديل 8 كينج براند','','138','445','475','475','475','2026-10-09','0','1','0','','0','0','0','0','0','445','445','445','445','445','0','6.74','0','0','.','0','0','0','445','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','445','445','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','445','0','0','0','0','0','0','','','0','0','0','0'); -- id=1789
UPDATE product SET productName = 'موديل 8 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '445', productSellAllPrice = '475', productSellUnitPrice = '475', productSellHalfPrice = '475', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01789',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445',lastbuyprice_withDiscount = '445',meanbuyprice = '445',meanbuyprice_withDiscount = '445' , productbuypricereal = '445' , buypricereal_precentage = '0' , buytotal_precentage = '6.74' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='445',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='445',meanbuyprice_withTax='445',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='445',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1789';
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', '1789', '1.00', '2026-10-09', '1', '0','0178901','475','475','475','445','','0','0','0','0','0','0','0','0','0','0'); -- id=1789
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1789', '1', '0', '1', '2026-10-09'); -- id=2802
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1789', '1', '0', '0', '1789', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4005
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1789, 1,'2026-10-09 13:04:49',1)
                ON DUPLICATE KEY UPDATE productid = 1789, edited = 1, sysdate = '2026-10-09 13:04:49', userid = 1; -- id=2706
UPDATE product SET productName = 'موديل 8 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '445.00', productSellAllPrice = '475.00', productSellUnitPrice = '475.00', productSellHalfPrice = '475.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01789',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445',lastbuyprice_withDiscount = '445',meanbuyprice = '445',meanbuyprice_withDiscount = '445' , productbuypricereal = '445' , buypricereal_precentage = '0' , buytotal_precentage = '6.74' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='445',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='445',meanbuyprice_withTax='445',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='445',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1789';
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 ('موديل 9 كينج براند','','138','430','460','460','460','2026-10-09','0','1','0','','0','0','0','0','0','430','430','430','430','430','0','6.98','0','0','.','0','0','0','430','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','430','430','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','430','0','0','0','0','0','0','','','0','0','0','0'); -- id=1790
UPDATE product SET productName = 'موديل 9 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '430', productSellAllPrice = '460', productSellUnitPrice = '460', productSellHalfPrice = '460', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01790',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '430',lastbuyprice_withDiscount = '430',meanbuyprice = '430',meanbuyprice_withDiscount = '430' , productbuypricereal = '430' , buypricereal_precentage = '0' , buytotal_precentage = '6.98' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='430',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='430',meanbuyprice_withTax='430',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='430',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1790';
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', '1790', '1.00', '2026-10-09', '1', '0','0179001','460','460','460','430','','0','0','0','0','0','0','0','0','0','0'); -- id=1790
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1790', '1', '0', '1', '2026-10-09'); -- id=2803
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1790', '1', '0', '0', '1790', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4006
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1790, 1,'2026-10-09 13:04:49',1)
                ON DUPLICATE KEY UPDATE productid = 1790, edited = 1, sysdate = '2026-10-09 13:04:49', userid = 1; -- id=2707
UPDATE product SET productName = 'موديل 9 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '430.00', productSellAllPrice = '460.00', productSellUnitPrice = '460.00', productSellHalfPrice = '460.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01790',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '430',lastbuyprice_withDiscount = '430',meanbuyprice = '430',meanbuyprice_withDiscount = '430' , productbuypricereal = '430' , buypricereal_precentage = '0' , buytotal_precentage = '6.98' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='430',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='430',meanbuyprice_withTax='430',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='430',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1790';
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 ('موديل 10 كينج براند','','138','430','460','460','460','2026-10-09','0','1','0','','0','0','0','0','0','430','430','430','430','430','0','6.98','0','0','.','0','0','0','430','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','430','430','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','430','0','0','0','0','0','0','','','0','0','0','0'); -- id=1791
UPDATE product SET productName = 'موديل 10 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '430', productSellAllPrice = '460', productSellUnitPrice = '460', productSellHalfPrice = '460', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01791',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '430',lastbuyprice_withDiscount = '430',meanbuyprice = '430',meanbuyprice_withDiscount = '430' , productbuypricereal = '430' , buypricereal_precentage = '0' , buytotal_precentage = '6.98' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='430',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='430',meanbuyprice_withTax='430',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='430',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1791';
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', '1791', '1.00', '2026-10-09', '1', '0','0179101','460','460','460','430','','0','0','0','0','0','0','0','0','0','0'); -- id=1791
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1791', '1', '0', '1', '2026-10-09'); -- id=2804
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1791', '1', '0', '0', '1791', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4007
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1791, 1,'2026-10-09 13:04:49',1)
                ON DUPLICATE KEY UPDATE productid = 1791, edited = 1, sysdate = '2026-10-09 13:04:49', userid = 1; -- id=2708
UPDATE product SET productName = 'موديل 10 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '430.00', productSellAllPrice = '460.00', productSellUnitPrice = '460.00', productSellHalfPrice = '460.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01791',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '430',lastbuyprice_withDiscount = '430',meanbuyprice = '430',meanbuyprice_withDiscount = '430' , productbuypricereal = '430' , buypricereal_precentage = '0' , buytotal_precentage = '6.98' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='430',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='430',meanbuyprice_withTax='430',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='430',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1791';
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 ('موديل 11 كينج براند','','138','470','500','500','500','2026-10-09','0','1','0','','0','0','0','0','0','470','470','470','470','470','0','6.38','0','0','.','0','0','0','470','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','470','470','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','470','0','0','0','0','0','0','','','0','0','0','0'); -- id=1792
UPDATE product SET productName = 'موديل 11 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '470', productSellAllPrice = '500', productSellUnitPrice = '500', productSellHalfPrice = '500', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01792',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '470',lastbuyprice_withDiscount = '470',meanbuyprice = '470',meanbuyprice_withDiscount = '470' , productbuypricereal = '470' , buypricereal_precentage = '0' , buytotal_precentage = '6.38' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='470',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='470',meanbuyprice_withTax='470',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='470',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1792';
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', '1792', '1.00', '2026-10-09', '1', '0','0179201','500','500','500','470','','0','0','0','0','0','0','0','0','0','0'); -- id=1792
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1792', '1', '0', '1', '2026-10-09'); -- id=2805
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1792', '1', '0', '0', '1792', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4008
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1792, 1,'2026-10-09 13:04:49',1)
                ON DUPLICATE KEY UPDATE productid = 1792, edited = 1, sysdate = '2026-10-09 13:04:49', userid = 1; -- id=2709
UPDATE product SET productName = 'موديل 11 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '470.00', productSellAllPrice = '500.00', productSellUnitPrice = '500.00', productSellHalfPrice = '500.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01792',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '470',lastbuyprice_withDiscount = '470',meanbuyprice = '470',meanbuyprice_withDiscount = '470' , productbuypricereal = '470' , buypricereal_precentage = '0' , buytotal_precentage = '6.38' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='470',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='470',meanbuyprice_withTax='470',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='470',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1792';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 12 كينج براند','','138','425','455','455','455','2026-10-09','0','1','0','','0','0','0','0','0','425','425','425','425','425','0','7.06','0','0','.','0','0','0','425','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','425','425','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','425','0','0','0','0','0','0','','','0','0','0','0'); -- id=1793
UPDATE product SET productName = 'موديل 12 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '425', productSellAllPrice = '455', productSellUnitPrice = '455', productSellHalfPrice = '455', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01793',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '425',lastbuyprice_withDiscount = '425',meanbuyprice = '425',meanbuyprice_withDiscount = '425' , productbuypricereal = '425' , buypricereal_precentage = '0' , buytotal_precentage = '7.06' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='425',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='425',meanbuyprice_withTax='425',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='425',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1793';
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', '1793', '1.00', '2026-10-09', '1', '0','0179301','455','455','455','425','','0','0','0','0','0','0','0','0','0','0'); -- id=1793
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1793', '1', '0', '1', '2026-10-09'); -- id=2806
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1793', '1', '0', '0', '1793', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4009
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1793, 1,'2026-10-09 13:04:49',1)
                ON DUPLICATE KEY UPDATE productid = 1793, edited = 1, sysdate = '2026-10-09 13:04:49', userid = 1; -- id=2710
UPDATE product SET productName = 'موديل 12 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '425.00', productSellAllPrice = '455.00', productSellUnitPrice = '455.00', productSellHalfPrice = '455.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01793',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '425',lastbuyprice_withDiscount = '425',meanbuyprice = '425',meanbuyprice_withDiscount = '425' , productbuypricereal = '425' , buypricereal_precentage = '0' , buytotal_precentage = '7.06' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='425',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='425',meanbuyprice_withTax='425',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='425',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1793';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:34:50";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:04:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 13:04:50', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=5850
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:34:53";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:04:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 13:04:53', '1', 'bill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=5851
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('كينج براند', '', '', '', '', '0', '1', '2026-10-09 13:05:03', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=134
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 ('134', '0', '', '0', 'إضافة مورد جديد', '134', '', '2026-10-09 13:05:03', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=287
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('كينج براند', 'كينج براند', 'كينج براند', 'كينج براند', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 13:05:03'); -- id=617
UPDATE supplier SET suppliername = 'كينج براند', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='617',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '134';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:36:39";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:06:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 13:06:39', '1', 'add', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=5852
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 ('06ac8bc457a2d8', '2026-10-09 13:04:53', '134', '0.00', '139245', '0', '0', '139245.00',  '139245.00', '0', '139245', '1', '2026-10-09 13:06:39', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=92
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 ('01782', '92', '138', '1782', '30', '390', '11700.00', '0', '', '2026-10-09 13:06:39', '1782','','','0','0','0','0','0',null,'390','11700','0','0','0','0','0','0','0','0','1'); -- id=590
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 13:04:53', 1, 1782, 0, 0
                    , 390, 30, 0, 0, 1, '2026-10-09 13:06:39')
                ON DUPLICATE KEY UPDATE buyprice = 390,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 13:06:39' ; -- id=756
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1782', '390', '30', '0', 'buyBillController.php', '590', '', '0', '0'); -- id=465
UPDATE product SET  productBuyPrice = "390" WHERE productId = 1782 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 590 ;
UPDATE product SET productName = 'موديل 1 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '390.00', productSellAllPrice = '420.00', productSellUnitPrice = '420.00', productSellHalfPrice = '420.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01782',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '390',lastbuyprice_withDiscount = '390',meanbuyprice = '390',meanbuyprice_withDiscount = '390' , productbuypricereal = '390.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.69' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='390',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='390',meanbuyprice_withTax='390',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='390',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1782';
UPDATE buybilldetail SET  lastbuyprice = 390 , meanbuyprice = 390, lastbuyprice_withDiscount = 390, meanbuyprice_withDiscount = 390
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 390
                where buybilldetailid = 590;
UPDATE productunit SET proUnitBuyPrice  = 390 * productnumber WHERE productid = 1782;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2795';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1782', '1', '30', '0', '92', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '1', '2026-10-09 13:04:53','0','0'); -- id=4010
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 ('01783', '92', '138', '1783', '30', '350', '10500.00', '0', '', '2026-10-09 13:06:39', '1783','','','0','0','0','0','0',null,'350','10500','0','0','0','0','0','0','0','0','1'); -- id=591
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 13:04:53', 1, 1783, 0, 0
                    , 350, 30, 0, 0, 1, '2026-10-09 13:06:39')
                ON DUPLICATE KEY UPDATE buyprice = 350,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 13:06:39' ; -- id=757
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1783', '350', '30', '0', 'buyBillController.php', '591', '', '0', '0'); -- id=466
UPDATE product SET  productBuyPrice = "350" WHERE productId = 1783 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 591 ;
UPDATE product SET productName = 'موديل 2 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '350.00', productSellAllPrice = '380.00', productSellUnitPrice = '380.00', productSellHalfPrice = '380.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01783',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '8.57' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',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='350',meanbuyprice_withTax='350',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='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1783';
UPDATE buybilldetail SET  lastbuyprice = 350 , meanbuyprice = 350, lastbuyprice_withDiscount = 350, meanbuyprice_withDiscount = 350
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where buybilldetailid = 591;
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 1783;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2796';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1783', '1', '30', '0', '92', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '1', '2026-10-09 13:04:53','0','0'); -- id=4011
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 ('01784', '92', '138', '1784', '27', '350', '9450.00', '0', '', '2026-10-09 13:06:39', '1784','','','0','0','0','0','0',null,'350','9450','0','0','0','0','0','0','0','0','1'); -- id=592
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 13:04:53', 1, 1784, 0, 0
                    , 350, 27, 0, 0, 1, '2026-10-09 13:06:39')
                ON DUPLICATE KEY UPDATE buyprice = 350,
                        buyQuantity =buyQuantity+27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 13:06:39' ; -- id=758
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1784', '350', '27', '0', 'buyBillController.php', '592', '', '0', '0'); -- id=467
UPDATE product SET  productBuyPrice = "350" WHERE productId = 1784 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 592 ;
UPDATE product SET productName = 'موديل 3 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '350.00', productSellAllPrice = '380.00', productSellUnitPrice = '380.00', productSellHalfPrice = '380.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01784',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '8.57' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',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='350',meanbuyprice_withTax='350',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='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1784';
UPDATE buybilldetail SET  lastbuyprice = 350 , meanbuyprice = 350, lastbuyprice_withDiscount = 350, meanbuyprice_withDiscount = 350
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where buybilldetailid = 592;
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 1784;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2797';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1784', '1', '27', '0', '92', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '27', '1', '2026-10-09 13:04:53','0','0'); -- id=4012
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 ('01785', '92', '138', '1785', '18', '400', '7200.00', '0', '', '2026-10-09 13:06:39', '1785','','','0','0','0','0','0',null,'400','7200','0','0','0','0','0','0','0','0','1'); -- id=593
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 13:04:53', 1, 1785, 0, 0
                    , 400, 18, 0, 0, 1, '2026-10-09 13:06:39')
                ON DUPLICATE KEY UPDATE buyprice = 400,
                        buyQuantity =buyQuantity+18, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 13:06:39' ; -- id=759
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1785', '400', '18', '0', 'buyBillController.php', '593', '', '0', '0'); -- id=468
UPDATE product SET  productBuyPrice = "400" WHERE productId = 1785 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 593 ;
UPDATE product SET productName = 'موديل 4 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '400.00', productSellAllPrice = '430.00', productSellUnitPrice = '430.00', productSellHalfPrice = '430.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01785',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '400',lastbuyprice_withDiscount = '400',meanbuyprice = '400',meanbuyprice_withDiscount = '400' , productbuypricereal = '400.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.50' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='400',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='400',meanbuyprice_withTax='400',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='400',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1785';
UPDATE buybilldetail SET  lastbuyprice = 400 , meanbuyprice = 400, lastbuyprice_withDiscount = 400, meanbuyprice_withDiscount = 400
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 400
                where buybilldetailid = 593;
UPDATE productunit SET proUnitBuyPrice  = 400 * productnumber WHERE productid = 1785;
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2798';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1785', '1', '18', '0', '92', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '18', '1', '2026-10-09 13:04:53','0','0'); -- id=4013
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 ('01786', '92', '138', '1786', '33', '440', '14520.00', '0', '', '2026-10-09 13:06:39', '1786','','','0','0','0','0','0',null,'440','14520','0','0','0','0','0','0','0','0','1'); -- id=594
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 13:04:53', 1, 1786, 0, 0
                    , 440, 33, 0, 0, 1, '2026-10-09 13:06:39')
                ON DUPLICATE KEY UPDATE buyprice = 440,
                        buyQuantity =buyQuantity+33, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 13:06:39' ; -- id=760
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1786', '440', '33', '0', 'buyBillController.php', '594', '', '0', '0'); -- id=469
UPDATE product SET  productBuyPrice = "440" WHERE productId = 1786 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 594 ;
UPDATE product SET productName = 'موديل 5 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '440.00', productSellAllPrice = '470.00', productSellUnitPrice = '470.00', productSellHalfPrice = '470.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01786',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.82' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',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='440',meanbuyprice_withTax='440',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='440',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1786';
UPDATE buybilldetail SET  lastbuyprice = 440 , meanbuyprice = 440, lastbuyprice_withDiscount = 440, meanbuyprice_withDiscount = 440
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 440
                where buybilldetailid = 594;
UPDATE productunit SET proUnitBuyPrice  = 440 * productnumber WHERE productid = 1786;
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2799';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1786', '1', '33', '0', '92', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '33', '1', '2026-10-09 13:04:53','0','0'); -- id=4014
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 ('01787', '92', '138', '1787', '27', '410', '11070.00', '0', '', '2026-10-09 13:06:39', '1787','','','0','0','0','0','0',null,'410','11070','0','0','0','0','0','0','0','0','1'); -- id=595
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 13:04:53', 1, 1787, 0, 0
                    , 410, 27, 0, 0, 1, '2026-10-09 13:06:39')
                ON DUPLICATE KEY UPDATE buyprice = 410,
                        buyQuantity =buyQuantity+27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 13:06:39' ; -- id=761
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1787', '410', '27', '0', 'buyBillController.php', '595', '', '0', '0'); -- id=470
UPDATE product SET  productBuyPrice = "410" WHERE productId = 1787 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 595 ;
UPDATE product SET productName = 'موديل 6 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '410.00', productSellAllPrice = '440.00', productSellUnitPrice = '440.00', productSellHalfPrice = '440.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01787',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410',lastbuyprice_withDiscount = '410',meanbuyprice = '410',meanbuyprice_withDiscount = '410' , productbuypricereal = '410.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.32' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',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='410',meanbuyprice_withTax='410',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='410',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1787';
UPDATE buybilldetail SET  lastbuyprice = 410 , meanbuyprice = 410, lastbuyprice_withDiscount = 410, meanbuyprice_withDiscount = 410
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 410, lastbuyprice_withDiscountAndTax = 410
                where buybilldetailid = 595;
UPDATE productunit SET proUnitBuyPrice  = 410 * productnumber WHERE productid = 1787;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2800';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1787', '1', '27', '0', '92', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '27', '1', '2026-10-09 13:04:53','0','0'); -- id=4015
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 ('01788', '92', '138', '1788', '33', '345', '11385.00', '0', '', '2026-10-09 13:06:39', '1788','','','0','0','0','0','0',null,'345','11385','0','0','0','0','0','0','0','0','1'); -- id=596
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 13:04:53', 1, 1788, 0, 0
                    , 345, 33, 0, 0, 1, '2026-10-09 13:06:39')
                ON DUPLICATE KEY UPDATE buyprice = 345,
                        buyQuantity =buyQuantity+33, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 13:06:39' ; -- id=762
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1788', '345', '33', '0', 'buyBillController.php', '596', '', '0', '0'); -- id=471
UPDATE product SET  productBuyPrice = "345" WHERE productId = 1788 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 596 ;
UPDATE product SET productName = 'موديل 7 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '345.00', productSellAllPrice = '375.00', productSellUnitPrice = '375.00', productSellHalfPrice = '375.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01788',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '345',lastbuyprice_withDiscount = '345',meanbuyprice = '345',meanbuyprice_withDiscount = '345' , productbuypricereal = '345.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '8.70' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='345',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='345',meanbuyprice_withTax='345',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='345',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1788';
UPDATE buybilldetail SET  lastbuyprice = 345 , meanbuyprice = 345, lastbuyprice_withDiscount = 345, meanbuyprice_withDiscount = 345
        , lastbuyprice_withTax = 345, meanbuyprice_withTax = 345, lastbuyprice_withDiscountAndTax = 345
                where buybilldetailid = 596;
UPDATE productunit SET proUnitBuyPrice  = 345 * productnumber WHERE productid = 1788;
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2801';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1788', '1', '33', '0', '92', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '33', '1', '2026-10-09 13:04:53','0','0'); -- id=4016
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 ('01789', '92', '138', '1789', '30', '445', '13350.00', '0', '', '2026-10-09 13:06:39', '1789','','','0','0','0','0','0',null,'445','13350','0','0','0','0','0','0','0','0','1'); -- id=597
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 13:04:53', 1, 1789, 0, 0
                    , 445, 30, 0, 0, 1, '2026-10-09 13:06:39')
                ON DUPLICATE KEY UPDATE buyprice = 445,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 13:06:39' ; -- id=763
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1789', '445', '30', '0', 'buyBillController.php', '597', '', '0', '0'); -- id=472
UPDATE product SET  productBuyPrice = "445" WHERE productId = 1789 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 597 ;
UPDATE product SET productName = 'موديل 8 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '445.00', productSellAllPrice = '475.00', productSellUnitPrice = '475.00', productSellHalfPrice = '475.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01789',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445',lastbuyprice_withDiscount = '445',meanbuyprice = '445',meanbuyprice_withDiscount = '445' , productbuypricereal = '445.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.74' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='445',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='445',meanbuyprice_withTax='445',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='445',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1789';
UPDATE buybilldetail SET  lastbuyprice = 445 , meanbuyprice = 445, lastbuyprice_withDiscount = 445, meanbuyprice_withDiscount = 445
        , lastbuyprice_withTax = 445, meanbuyprice_withTax = 445, lastbuyprice_withDiscountAndTax = 445
                where buybilldetailid = 597;
UPDATE productunit SET proUnitBuyPrice  = 445 * productnumber WHERE productid = 1789;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2802';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1789', '1', '30', '0', '92', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '1', '2026-10-09 13:04:53','0','0'); -- id=4017
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 ('01790', '92', '138', '1790', '27', '430', '11610.00', '0', '', '2026-10-09 13:06:39', '1790','','','0','0','0','0','0',null,'430','11610','0','0','0','0','0','0','0','0','1'); -- id=598
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 13:04:53', 1, 1790, 0, 0
                    , 430, 27, 0, 0, 1, '2026-10-09 13:06:39')
                ON DUPLICATE KEY UPDATE buyprice = 430,
                        buyQuantity =buyQuantity+27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 13:06:39' ; -- id=764
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1790', '430', '27', '0', 'buyBillController.php', '598', '', '0', '0'); -- id=473
UPDATE product SET  productBuyPrice = "430" WHERE productId = 1790 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 598 ;
UPDATE product SET productName = 'موديل 9 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '430.00', productSellAllPrice = '460.00', productSellUnitPrice = '460.00', productSellHalfPrice = '460.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01790',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '430',lastbuyprice_withDiscount = '430',meanbuyprice = '430',meanbuyprice_withDiscount = '430' , productbuypricereal = '430.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.98' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='430',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='430',meanbuyprice_withTax='430',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='430',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1790';
UPDATE buybilldetail SET  lastbuyprice = 430 , meanbuyprice = 430, lastbuyprice_withDiscount = 430, meanbuyprice_withDiscount = 430
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where buybilldetailid = 598;
UPDATE productunit SET proUnitBuyPrice  = 430 * productnumber WHERE productid = 1790;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2803';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1790', '1', '27', '0', '92', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '27', '1', '2026-10-09 13:04:53','0','0'); -- id=4018
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 ('01791', '92', '138', '1791', '27', '430', '11610.00', '0', '', '2026-10-09 13:06:39', '1791','','','0','0','0','0','0',null,'430','11610','0','0','0','0','0','0','0','0','1'); -- id=599
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 13:04:53', 1, 1791, 0, 0
                    , 430, 27, 0, 0, 1, '2026-10-09 13:06:39')
                ON DUPLICATE KEY UPDATE buyprice = 430,
                        buyQuantity =buyQuantity+27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 13:06:39' ; -- id=765
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1791', '430', '27', '0', 'buyBillController.php', '599', '', '0', '0'); -- id=474
UPDATE product SET  productBuyPrice = "430" WHERE productId = 1791 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 599 ;
UPDATE product SET productName = 'موديل 10 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '430.00', productSellAllPrice = '460.00', productSellUnitPrice = '460.00', productSellHalfPrice = '460.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01791',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '430',lastbuyprice_withDiscount = '430',meanbuyprice = '430',meanbuyprice_withDiscount = '430' , productbuypricereal = '430.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.98' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='430',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='430',meanbuyprice_withTax='430',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='430',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1791';
UPDATE buybilldetail SET  lastbuyprice = 430 , meanbuyprice = 430, lastbuyprice_withDiscount = 430, meanbuyprice_withDiscount = 430
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where buybilldetailid = 599;
UPDATE productunit SET proUnitBuyPrice  = 430 * productnumber WHERE productid = 1791;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2804';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1791', '1', '27', '0', '92', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '27', '1', '2026-10-09 13:04:53','0','0'); -- id=4019
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 ('01792', '92', '138', '1792', '30', '470', '14100.00', '0', '', '2026-10-09 13:06:39', '1792','','','0','0','0','0','0',null,'470','14100','0','0','0','0','0','0','0','0','1'); -- id=600
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 13:04:53', 1, 1792, 0, 0
                    , 470, 30, 0, 0, 1, '2026-10-09 13:06:39')
                ON DUPLICATE KEY UPDATE buyprice = 470,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 13:06:39' ; -- id=766
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1792', '470', '30', '0', 'buyBillController.php', '600', '', '0', '0'); -- id=475
UPDATE product SET  productBuyPrice = "470" WHERE productId = 1792 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 600 ;
UPDATE product SET productName = 'موديل 11 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '470.00', productSellAllPrice = '500.00', productSellUnitPrice = '500.00', productSellHalfPrice = '500.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01792',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '470',lastbuyprice_withDiscount = '470',meanbuyprice = '470',meanbuyprice_withDiscount = '470' , productbuypricereal = '470.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.38' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='470',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='470',meanbuyprice_withTax='470',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='470',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1792';
UPDATE buybilldetail SET  lastbuyprice = 470 , meanbuyprice = 470, lastbuyprice_withDiscount = 470, meanbuyprice_withDiscount = 470
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 470
                where buybilldetailid = 600;
UPDATE productunit SET proUnitBuyPrice  = 470 * productnumber WHERE productid = 1792;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2805';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1792', '1', '30', '0', '92', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '1', '2026-10-09 13:04:53','0','0'); -- id=4020
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 ('01793', '92', '138', '1793', '30', '425', '12750.00', '0', '', '2026-10-09 13:06:39', '1793','','','0','0','0','0','0',null,'425','12750','0','0','0','0','0','0','0','0','1'); -- id=601
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 13:04:53', 1, 1793, 0, 0
                    , 425, 30, 0, 0, 1, '2026-10-09 13:06:39')
                ON DUPLICATE KEY UPDATE buyprice = 425,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 13:06:39' ; -- id=767
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1793', '425', '30', '0', 'buyBillController.php', '601', '', '0', '0'); -- id=476
UPDATE product SET  productBuyPrice = "425" WHERE productId = 1793 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 601 ;
UPDATE product SET productName = 'موديل 12 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '425.00', productSellAllPrice = '455.00', productSellUnitPrice = '455.00', productSellHalfPrice = '455.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01793',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '425',lastbuyprice_withDiscount = '425',meanbuyprice = '425',meanbuyprice_withDiscount = '425' , productbuypricereal = '425.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.06' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='425',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='425',meanbuyprice_withTax='425',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='425',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1793';
UPDATE buybilldetail SET  lastbuyprice = 425 , meanbuyprice = 425, lastbuyprice_withDiscount = 425, meanbuyprice_withDiscount = 425
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where buybilldetailid = 601;
UPDATE productunit SET proUnitBuyPrice  = 425 * productnumber WHERE productid = 1793;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2806';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1793', '1', '30', '0', '92', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '1', '2026-10-09 13:04:53','0','0'); -- id=4021
UPDATE supplier SET  suppliercurrentDebt = '139245',suppliercurrentDebtInCurrency= '139245' , userid = '1', supplierdate = '2026-10-09 13:06:39'   WHERE supplierid = '134';
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 ('134', '0.00', '139245', '0', 'اضافة فاتورة مشتريات', '92', '139245', '2026-10-09 13:04:53', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','139245','1','0','139245','139245','0',''); -- id=288
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '139245', '139245', '2026-10-09', '1', '0', '0', '2026-10-09 13:06:39','اضافة فاتورة مشتريات رقم 92','1','0',null,'0','92','buyBillController.php?do=details&id=92'); -- id=1760
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1760', '382', '139245', '','0'); -- id=1790
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20024710.65', 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 ('1760', '617', '139245', '','0'); -- id=1760
UPDATE accountstree SET name = 'كينج براند', customName = 'كينج براند', customNameEn = 'كينج براند', nameEn = 'كينج براند', parent = '81', accountNature = '1', theValue = '139245', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 13:05:03' WHERE id = '617';
update buybill set dailyentryid='1760,0' where buybillid=92;
COMMIT;
UPDATE product SET overAllAveragePrice = 390 WHERE productId = 1782;UPDATE product SET overAllAveragePrice = 350 WHERE productId = 1783;UPDATE product SET overAllAveragePrice = 350 WHERE productId = 1784;UPDATE product SET overAllAveragePrice = 400 WHERE productId = 1785;UPDATE product SET overAllAveragePrice = 440 WHERE productId = 1786;UPDATE product SET overAllAveragePrice = 410 WHERE productId = 1787;UPDATE product SET overAllAveragePrice = 345 WHERE productId = 1788;UPDATE product SET overAllAveragePrice = 445 WHERE productId = 1789;UPDATE product SET overAllAveragePrice = 430 WHERE productId = 1790;UPDATE product SET overAllAveragePrice = 430 WHERE productId = 1791;UPDATE product SET overAllAveragePrice = 470 WHERE productId = 1792;UPDATE product SET overAllAveragePrice = 425 WHERE productId = 1793;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:36:40";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:06:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 13:06:40', '1', 'editprint', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=92'); -- id=5853
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:36:44";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:06:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 13:06:44', '1', 'showbarcodebuybill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=92&type=2'); -- id=5854
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:37:56";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:07:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 13:07:56', '1', 'showbarcodebuybill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=92&type=2'); -- id=5855
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:40:18";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:10:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 13:10:18', '1', 'editprint', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=92'); -- id=5856
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:41:54";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:41:57";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:11:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 13:11:57', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5857
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:41:57";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 13:11:57', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5858
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:42:01";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:12:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 13:12:01', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5859
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:42:48";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:12:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 13:12:48', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5860
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:43:27";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:13:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 13:13:27', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5861
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 09:43:47";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:13:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 13:13:47', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5862
UPDATE user SET loginip = "" WHERE userid = 3;
UPDATE user SET loginip = "" WHERE userid = 4;
UPDATE user SET loginip = "" WHERE userid = 2;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:04:15";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:04:28";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:34:28", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 13:34:28', '4', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5863
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:04:29";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 13:34:29", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 13:34:29', '4', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5864
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:04:33";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:34:33", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 13:34:33', '4', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5865
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:04:44";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:34:44", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:34:44', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5866
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:05:51";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:35:51", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:35:51', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5867

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8c3444f088
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 13:35:51', '06ac8c3444f088', '1', '0.00', '0', '0', '1', '13320.00', '13320', '13320', '0', '2', '2026-10-09 13:35:51', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '32' ,'0','','','','','-1','0','0','0','0','0','13320','0','','0','0','13320','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=314
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','314', '0', '2026-10-09 13:35:51', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '13320', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 13:35:51','0','0','',''); -- id=422
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 143;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('380','01364', '314', '89', '1364', '20', '420', '8400', '0', '', '0', '2026-10-09 13:35:51', '1364', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','143-20,','1','1','0','0','420','8400','0','','0','0.00','0','0','0','0'); -- id=1133
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 1133;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1364, '2026-10-09', 8400, 7600, 7600
                    , 7600, 7600, 7600, 7600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 7600, 7600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8400, sellCostBuyPrice =sellCostBuyPrice+7600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 8400, 7600, 7600
                    , 7600, 7600, 7600, 7600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7600, 7600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8400, sellCostBuyPrice =sellCostBuyPrice+7600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '84', userid = '4', storedetaildate = '2026-10-09 13:35:51' WHERE storedetailid = '1411';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1364', '2', '20', '1', '314', 'اضافة فاتورة مبيعات', 'sellbillController.php', '104', '84', '4', '2026-10-09 13:35:51','0','0'); -- id=4022
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 224;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('380','01443', '314', '88', '1443', '12', '410', '4920', '0', '', '0', '2026-10-09 13:35:51', '1443', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','224-12,','1','1','0','0','410','4920','0','','0','0.00','0','0','0','0'); -- id=1134
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 1134;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1443, '2026-10-09', 4920, 4560, 4560
                    , 4560, 4560, 4560, 4560
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4560, 4560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4920, sellCostBuyPrice =sellCostBuyPrice+4560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4560
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-09', 4920, 4560, 4560
                    , 4560, 4560, 4560, 4560
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4560, 4560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4920, sellCostBuyPrice =sellCostBuyPrice+4560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4560
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '4', storedetaildate = '2026-10-09 13:35:51' WHERE storedetailid = '1474';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1443', '2', '12', '1', '314', 'اضافة فاتورة مبيعات', 'sellbillController.php', '31', '19', '4', '2026-10-09 13:35:51','0','0'); -- id=4023
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '433490',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('420170','13320', '0', '3', 'اضافة فاتورة مبيعات', '314', '433490', '2026-10-09 13:35:51', '4',  'sellbillController.php','1','','0'); -- id=360
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '13320', '13320', '2026-10-09', '4', '0', '0', '2026-10-09 13:35:51','اضافة فاتورة مبيعات رقم 314','1','0',null,'0','314','sellbillController.php?do=showDetail&sellbillid=314'); -- id=1761
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1761', '501', '13320', '','0'); -- id=1791
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '433490', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1761', '143', '13320', '','0'); -- id=1761
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3348775', 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 ( '12160', '12160', '2026-10-09', '4', '0', '0', '2026-10-09 13:35:51','اضافة فاتورة مبيعات رقم 314 - صرف البضاعة من المخزن','1','0',null,'0','314','sellbillController.php?do=showDetail&sellbillid=314'); -- id=1762
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1762', '402', '12160', '','0'); -- id=1792
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3144972.55', 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 ('1762', '492', '12160', '','0'); -- id=1762
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '738325', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1761,0,1762' where sellbillid=314;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 13320, 12160, 12160
                    , 12160, 12160, 12160, 12160
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12160, 12160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13320, sellCostBuyPrice =sellCostBuyPrice+12160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 13320, 12160, 12160
                    , 12160, 12160, 12160, 12160
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12160, 12160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13320, sellCostBuyPrice =sellCostBuyPrice+12160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12160
                        , returnSellVal = returnSellVal+0, 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, 13320, 12160, 12160
                    , 12160, 12160, 12160, 12160, 12160, 12160)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+13320, netSellCostBuyPrice = netSellCostBuyPrice+12160
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+12160
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+12160
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+12160
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+12160
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+12160
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+12160
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+12160;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8c3444f088 and sellbillId = 314 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:05:51";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:35:51", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:35:51', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5868
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:07:24";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:37:24", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 13:37:24', '6', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5869
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:08:14";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:38:14", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 13:38:14', '4', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5870
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:13:25";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:43:25", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:43:25', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5871
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:15:17";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:45:17", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:45:17', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5872

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8c54d1ce30
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 13:45:17', '06ac8c54d1ce30', '1', '0.00', '0', '0', '1', '1650.00', '1650', '1650', '0', '2', '2026-10-09 13:45:17', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '3' ,'0','','','','','-1','0','0','0','0','0','1650','0','','0','0','1650','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=315
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','315', '0', '2026-10-09 13:45:17', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1650', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 13:45:17','0','0','',''); -- id=423
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 621;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('495','01722', '315', '49', '1722', '3', '550', '1650', '0', '', '0', '2026-10-09 13:45:17', '1722', '0.00', '0', '2','0.00','','','0','0','0','0','0','0','0','0','','621-3,','1','1','0','0','550','1650','0','','0','0.00','0','0','0','0'); -- id=1135
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 495.00, meanbuyprice_withDiscount = 495.00
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 495
                where sellbilldetailid = 1135;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1722, '2026-10-09', 1650, 1650, 1650
                    , 1650, 1485, 1485, 1485
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1485, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1485
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1485
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1650, 1650, 1650
                    , 1650, 1485, 1485, 1485
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1485, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1485
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1485
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '54', userid = '4', storedetaildate = '2026-10-09 13:45:17' WHERE storedetailid = '2735';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1722', '2', '3', '1', '315', 'اضافة فاتورة مبيعات', 'sellbillController.php', '57', '54', '4', '2026-10-09 13:45:17','0','0'); -- id=4024
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '435140',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('433490','1650', '0', '3', 'اضافة فاتورة مبيعات', '315', '435140', '2026-10-09 13:45:17', '4',  'sellbillController.php','1','','0'); -- id=361
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1650', '1650', '2026-10-09', '4', '0', '0', '2026-10-09 13:45:17','اضافة فاتورة مبيعات رقم 315','1','0',null,'0','315','sellbillController.php?do=showDetail&sellbillid=315'); -- id=1763
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1763', '501', '1650', '','0'); -- id=1793
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '435140', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1763', '143', '1650', '','0'); -- id=1763
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3350425', 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 ( '1485', '1485', '2026-10-09', '4', '0', '0', '2026-10-09 13:45:17','اضافة فاتورة مبيعات رقم 315 - صرف البضاعة من المخزن','1','0',null,'0','315','sellbillController.php?do=showDetail&sellbillid=315'); -- id=1764
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1764', '402', '1485', '','0'); -- id=1794
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3146457.55', 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 ('1764', '492', '1485', '','0'); -- id=1764
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '736840', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1763,0,1764' where sellbillid=315;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 1650, 1650, 1650
                    , 1650, 1485, 1485, 1485
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1485, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1485
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1485
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1650, 1650, 1650
                    , 1650, 1485, 1485, 1485
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1485, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1485
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1485
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, 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, 1650, 1650, 1650
                    , 1650, 1485, 1485, 1485, 1650, 1650)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1650, netSellCostBuyPrice = netSellCostBuyPrice+1650
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1650
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1650
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1485
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1485
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1485
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1650
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1650;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8c54d1ce30 and sellbillId = 315 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:15:17";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:45:17", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:45:17', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5873
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:19:19";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:49:19", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:49:19', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5874
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:22:05";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:52:05", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:52:05', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5875

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8c5bdabcd4
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 13:52:05', '06ac8c5bdabcd4', '1', '0.00', '0', '0', '1', '3360.00', '3360', '3360', '0', '2', '2026-10-09 13:52:05', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '8' ,'0','','','','','-1','0','0','0','0','0','3360','0','','0','0','3360','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=316
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','316', '0', '2026-10-09 13:52:05', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3360', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 13:52:05','0','0','',''); -- id=424
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 225;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('390','01444', '316', '88', '1444', '4', '420', '1680', '0', '', '0', '2026-10-09 13:52:05', '1444', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','225-4,','1','1','0','0','420','1680','0','','0','0.00','0','0','0','0'); -- id=1136
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 390.00
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 390
                where sellbilldetailid = 1136;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1444, '2026-10-09', 1680, 1560, 1560
                    , 1560, 1560, 1560, 1560
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1560, 1560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1680, sellCostBuyPrice =sellCostBuyPrice+1560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1560
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1680, 1560, 1560
                    , 1560, 1560, 1560, 1560
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1560, 1560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1680, sellCostBuyPrice =sellCostBuyPrice+1560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1560
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '4', storedetaildate = '2026-10-09 13:52:05' WHERE storedetailid = '1475';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1444', '2', '4', '1', '316', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8', '4', '4', '2026-10-09 13:52:05','0','0'); -- id=4025
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 143;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('380','01364', '316', '89', '1364', '4', '420', '1680', '0', '', '0', '2026-10-09 13:52:05', '1364', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','143-4,','1','1','0','0','420','1680','0','','0','0.00','0','0','0','0'); -- id=1137
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 1137;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1364, '2026-10-09', 1680, 1520, 1520
                    , 1520, 1520, 1520, 1520
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1520, 1520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1680, sellCostBuyPrice =sellCostBuyPrice+1520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1680, 1520, 1520
                    , 1520, 1520, 1520, 1520
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1520, 1520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1680, sellCostBuyPrice =sellCostBuyPrice+1520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '80', userid = '4', storedetaildate = '2026-10-09 13:52:05' WHERE storedetailid = '1411';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1364', '2', '4', '1', '316', 'اضافة فاتورة مبيعات', 'sellbillController.php', '84', '80', '4', '2026-10-09 13:52:05','0','0'); -- id=4026
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '438500',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('435140','3360', '0', '3', 'اضافة فاتورة مبيعات', '316', '438500', '2026-10-09 13:52:05', '4',  'sellbillController.php','1','','0'); -- id=362
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3360', '3360', '2026-10-09', '4', '0', '0', '2026-10-09 13:52:05','اضافة فاتورة مبيعات رقم 316','1','0',null,'0','316','sellbillController.php?do=showDetail&sellbillid=316'); -- id=1765
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1765', '501', '3360', '','0'); -- id=1795
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '438500', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1765', '143', '3360', '','0'); -- id=1765
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3353785', 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 ( '3080', '3080', '2026-10-09', '4', '0', '0', '2026-10-09 13:52:05','اضافة فاتورة مبيعات رقم 316 - صرف البضاعة من المخزن','1','0',null,'0','316','sellbillController.php?do=showDetail&sellbillid=316'); -- id=1766
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1766', '402', '3080', '','0'); -- id=1796
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3149537.55', 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 ('1766', '492', '3080', '','0'); -- id=1766
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '733760', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1765,0,1766' where sellbillid=316;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 3360, 3080, 3080
                    , 3080, 3080, 3080, 3080
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3080, 3080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3360, 3080, 3080
                    , 3080, 3080, 3080, 3080
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3080, 3080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3080
                        , returnSellVal = returnSellVal+0, 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, 3360, 3080, 3080
                    , 3080, 3080, 3080, 3080, 3080, 3080)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3360, netSellCostBuyPrice = netSellCostBuyPrice+3080
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3080
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3080
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3080
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3080
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3080
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3080
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3080;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8c5bdabcd4 and sellbillId = 316 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:22:05";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:52:05", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:52:05', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5876
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:22:48";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:52:48", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:52:48', '6', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5877

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8c6afee65e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 13:52:49', '06ac8c6afee65e', '1', '0.00', '0', '0', '1', '2850.00', '2850', '2850', '0', '1', '2026-10-09 13:52:49', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '6' ,'0','','','','','-1','0','0','0','0','0','2850','0','','0','0','2850','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=317
UPDATE client SET  clientdebt = '0', userid = '6' 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','اضافة فاتورة مبيعات','317', '0', '2026-10-09 13:52:49', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2850', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 13:52:49','0','0','',''); -- id=425
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 560;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('405','01696', '317', '129', '1696', '3', '450', '1350', '0', '', '0', '2026-10-09 13:52:49', '1696', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','560-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=1138
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 405.00, meanbuyprice_withDiscount = 405.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 405
                where sellbilldetailid = 1138;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1696, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1215, 1215, 1215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1215, 1215, 1215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '135', userid = '6', storedetaildate = '2026-10-09 13:52:49' WHERE storedetailid = '2708';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1696', '1', '3', '1', '317', 'اضافة فاتورة مبيعات', 'sellbillController.php', '138', '135', '6', '2026-10-09 13:52:49','0','0'); -- id=4027
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 352;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('480','01506', '317', '108', '1506', '3', '500', '1500', '0', '', '0', '2026-10-09 13:52:49', '1506', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','352-3,','1','1','0','0','500','1500','0','','0','0.00','0','0','0','0'); -- id=1139
UPDATE sellbilldetail SET  lastbuyprice = 480.00 , meanbuyprice = 480.00, lastbuyprice_withDiscount = 480.00, meanbuyprice_withDiscount = 480.00
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 480, lastbuyprice_withDiscountAndTax = 480
                where sellbilldetailid = 1139;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1506, '2026-10-09', 1500, 1440, 1440
                    , 1440, 1440, 1440, 1440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1440, 1440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1500, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1500, 1440, 1440
                    , 1440, 1440, 1440, 1440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1440, 1440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1500, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '6', storedetaildate = '2026-10-09 13:52:49' WHERE storedetailid = '1531';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1506', '1', '3', '1', '317', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '27', '6', '2026-10-09 13:52:49','0','0'); -- id=4028
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '72545',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('69695','2850', '0', '4', 'اضافة فاتورة مبيعات', '317', '72545', '2026-10-09 13:52:49', '6',  'sellbillController.php','1','','0'); -- id=363
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2850', '2850', '2026-10-09', '6', '0', '0', '2026-10-09 13:52:49','اضافة فاتورة مبيعات رقم 317','1','0',null,'0','317','sellbillController.php?do=showDetail&sellbillid=317'); -- id=1767
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1767', '568', '2850', '','0'); -- id=1797
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '72545', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1767', '143', '2850', '','0'); -- id=1767
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3356635', 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 ( '2655', '2655', '2026-10-09', '6', '0', '0', '2026-10-09 13:52:49','اضافة فاتورة مبيعات رقم 317 - صرف البضاعة من المخزن','1','0',null,'0','317','sellbillController.php?do=showDetail&sellbillid=317'); -- id=1768
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1768', '402', '2655', '','0'); -- id=1798
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3152192.55', 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 ('1768', '382', '2655', '','0'); -- id=1768
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20022055.65', 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='1767,0,1768' where sellbillid=317;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 2850, 2790, 2790
                    , 2790, 2655, 2655, 2655
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2790, 2790, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2850, sellCostBuyPrice =sellCostBuyPrice+2790
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2790, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2790
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2655, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2655
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2655
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2790
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2790
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2850, 2790, 2790
                    , 2790, 2655, 2655, 2655
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2790, 2790, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2850, sellCostBuyPrice =sellCostBuyPrice+2790
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2790, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2790
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2655, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2655
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2655
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2790
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2790
                        , returnSellVal = returnSellVal+0, 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, 2850, 2790, 2790
                    , 2790, 2655, 2655, 2655, 2790, 2790)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2850, netSellCostBuyPrice = netSellCostBuyPrice+2790
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2790
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2790
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2655
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2655
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2655
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2790
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2790;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8c6afee65e and sellbillId = 317 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:22:49";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:52:49", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:52:49', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5878
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:24:31";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:24:35";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:54:35", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 13:54:35', '2', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5879
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:24:36";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 13:54:36", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 13:54:36', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5880
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:24:39";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:54:39", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:54:39', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5881
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:24:41";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:54:41", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:54:41', '2', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=313'); -- id=5882
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:24:43";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:54:43", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:54:43', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5883
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:24:58";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:54:58", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:54:58', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5884

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8c7f31ac29
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8c7f31ac29 and sellbillId = 318 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:24:58";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:54:58", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:54:58', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5885
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:25:07";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:55:07", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 13:55:07', '2', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5886
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:25:15";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:55:15", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:55:15', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5887
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:25:25";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:55:25", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:55:25', '6', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5888

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8c7814ac72
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8c7814ac72 and sellbillId = 319 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:25:26";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:55:26", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:55:26', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5889
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:26:51";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:26:52";
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 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 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 blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:27:10";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:27:10";
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 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 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 blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:27:35";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:27:35";
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 blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:27:51";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:57:51", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 13:57:51', '3', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5890
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:27:51";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 13:57:51', '3', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5891
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:27:54";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 13:57:54", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 13:57:54', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5892
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:30:09";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:00:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 14:00:09', '1', 'editprint', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=92'); -- id=5893
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:30:48";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:00:48", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:00:48', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5894

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8c813ee05e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 14:00:48', '06ac8c813ee05e', '1', '0.00', '0', '10', '1', '11480.00', '11470', '11470', '0', '1', '2026-10-09 14:00:48', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '32' ,'0','','','','','-1','0','0','0','0','0','11470','0','','0','0','11470','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=320
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','320', '0', '2026-10-09 14:00:48', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '11470', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 14:00:48','0','0','',''); -- id=428
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 355;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('276','01467', '320', '104', '1467', '12', '340', '4080', '0', '', '0', '2026-10-09 14:00:48', '1467', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','355-12,','1','1','0','0','340','4080','0','','0','0.00','0','0','0','0'); -- id=1142
UPDATE sellbilldetail SET  lastbuyprice = 276.00 , meanbuyprice = 276.00, lastbuyprice_withDiscount = 276.00, meanbuyprice_withDiscount = 276.00
        , lastbuyprice_withTax = 276, meanbuyprice_withTax = 276, lastbuyprice_withDiscountAndTax = 276
                where sellbilldetailid = 1142;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1467, '2026-10-09', 4076.4459930314, 3312, 3312
                    , 3312, 3312, 3312, 3312
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3312, 3312, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4076.4459930314, sellCostBuyPrice =sellCostBuyPrice+3312
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3312, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3312
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3312, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3312
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3312
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3312
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3312
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4076.4459930314, 3312, 3312
                    , 3312, 3312, 3312, 3312
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3312, 3312, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4076.4459930314, sellCostBuyPrice =sellCostBuyPrice+3312
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3312, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3312
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3312, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3312
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3312
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3312
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3312
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '700', userid = '2', storedetaildate = '2026-10-09 14:00:48' WHERE storedetailid = '1492';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1467', '1', '12', '1', '320', 'اضافة فاتورة مبيعات', 'sellbillController.php', '712', '700', '2', '2026-10-09 14:00:48','0','0'); -- id=4031
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 72;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01380', '320', '94', '1380', '12', '390', '4680', '0', '', '0', '2026-10-09 14:00:48', '1380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','72-12,','1','1','0','0','390','4680','0','','0','0.00','0','0','0','0'); -- id=1143
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1143;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-09', 4675.9233449477, 4200, 4200
                    , 4200, 4200, 4200, 4200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4200, 4200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4675.9233449477, sellCostBuyPrice =sellCostBuyPrice+4200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4675.9233449477, 4200, 4200
                    , 4200, 4200, 4200, 4200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4200, 4200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4675.9233449477, sellCostBuyPrice =sellCostBuyPrice+4200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '594', userid = '2', storedetaildate = '2026-10-09 14:00:48' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '12', '1', '320', 'اضافة فاتورة مبيعات', 'sellbillController.php', '606', '594', '2', '2026-10-09 14:00:48','0','0'); -- id=4032
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 355;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('276','01467', '320', '104', '1467', '8', '340', '2720', '0', '', '0', '2026-10-09 14:00:48', '1467', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','355-8,','1','1','0','0','340','2720','0','','0','0.00','0','0','0','0'); -- id=1144
UPDATE sellbilldetail SET  lastbuyprice = 276.00 , meanbuyprice = 276.00, lastbuyprice_withDiscount = 276.00, meanbuyprice_withDiscount = 276.00
        , lastbuyprice_withTax = 276, meanbuyprice_withTax = 276, lastbuyprice_withDiscountAndTax = 276
                where sellbilldetailid = 1144;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1467, '2026-10-09', 2717.6306620209, 2208, 2208
                    , 2208, 2208, 2208, 2208
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2208, 2208, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2717.6306620209, sellCostBuyPrice =sellCostBuyPrice+2208
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2208, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2208
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2208, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2208
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2208
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2208
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2208
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2717.6306620209, 2208, 2208
                    , 2208, 2208, 2208, 2208
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2208, 2208, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2717.6306620209, sellCostBuyPrice =sellCostBuyPrice+2208
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2208, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2208
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2208, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2208
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2208
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2208
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2208
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 14:00:48' WHERE storedetailid = '1492';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1467', '1', '8', '1', '320', 'اضافة فاتورة مبيعات', 'sellbillController.php', '700', '692', '2', '2026-10-09 14:00:48','0','0'); -- id=4033
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1863105',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1851635','11470', '0', '2', 'اضافة فاتورة مبيعات', '320', '1863105', '2026-10-09 14:00:48', '2',  'sellbillController.php','1','','0'); -- id=366
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '11480', '11480', '2026-10-09', '2', '0', '0', '2026-10-09 14:00:48','اضافة فاتورة مبيعات رقم 320','1','0',null,'0','320','sellbillController.php?do=showDetail&sellbillid=320'); -- id=1773
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1773', '419', '11470', '','0'); -- id=1803
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1863105', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1773', '398', '10', '','0'); -- id=1804
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '137458', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1773', '143', '11480', '','0'); -- id=1773
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3377355', 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 ( '9720', '9720', '2026-10-09', '2', '0', '0', '2026-10-09 14:00:48','اضافة فاتورة مبيعات رقم 320 - صرف البضاعة من المخزن','1','0',null,'0','320','sellbillController.php?do=showDetail&sellbillid=320'); -- id=1774
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1774', '402', '9720', '','0'); -- id=1805
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3170925.75', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1774', '382', '9720', '','0'); -- id=1774
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20003322.45', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1773,0,1774' where sellbillid=320;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 11470, 9720, 9720
                    , 9720, 9720, 9720, 9720
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9720, 9720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11470, sellCostBuyPrice =sellCostBuyPrice+9720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9720, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9720
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 11470, 9720, 9720
                    , 9720, 9720, 9720, 9720
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9720, 9720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11470, sellCostBuyPrice =sellCostBuyPrice+9720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9720, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9720
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9720
                        , returnSellVal = returnSellVal+0, 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, 11470, 9720, 9720
                    , 9720, 9720, 9720, 9720, 9720, 9720)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+11470, netSellCostBuyPrice = netSellCostBuyPrice+9720
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+9720
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+9720
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+9720
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+9720
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+9720
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+9720
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+9720;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8c813ee05e and sellbillId = 320 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:30:48";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:00:48", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:00:48', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5895
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:32:19";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:02:19", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:02:19', '2', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=320'); -- id=5896
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:32:24";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:02:24", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:02:24', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5897
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:32:54";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:32:56";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:02:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 14:02:56', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5898
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:32:57";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 14:02:57', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5899
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:33:10";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:03:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:03:10', '1', 'showNew', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showNew'); -- id=5900
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:33:29";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:03:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:03:29', '1', 'showNew', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showNew'); -- id=5901
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:33:43";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:03:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:03:43', '1', 'showNew', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showNew'); -- id=5902
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:33:49";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:03:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:03:49', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5903
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:33:54";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:03:54", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:03:54', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5904

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8c9c0deff9
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8c9c0deff9 and sellbillId = 321 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:33:54";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:03:54", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:03:54', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5905
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:34:10";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:04:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:04:10', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5906
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:34:49";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:04:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:04:49', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5907
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:35:04";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:05:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:05:04', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5908
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:35:25";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:05:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:05:25', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5909
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:35:51";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:05:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:05:51', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5910
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:36:20";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:06:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:06:20', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5911
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:37:16";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:07:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:07:16', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5912
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:37:30";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:07:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:07:30', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5913
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:38:12";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:08:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:08:12', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5914
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:38:41";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:08:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:08:41', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5915
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:38:42";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:08:42", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:08:42', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5916

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8c8b2c1b90
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 14:08:42', '06ac8c8b2c1b90', '1', '0.00', '0', '0', '1', '8910.00', '8910', '8910', '0', '1', '2026-10-09 14:08:42', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '24' ,'0','','','','','-1','0','0','0','0','0','8910','0','','0','0','8910','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=322
UPDATE client SET  clientdebt = '0', userid = '3' 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','اضافة فاتورة مبيعات','322', '0', '2026-10-09 14:08:42', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '8910', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 14:08:42','0','0','',''); -- id=430
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('530','09828', '322', '5', '660', '5', '550', '2750', '0', '', '0', '2026-10-09 14:08:42', '660', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','550','2750','0','','0','0.00','0','0','0','0'); -- id=1146
UPDATE sellbilldetail SET  lastbuyprice = 530.00 , meanbuyprice = 530.00, lastbuyprice_withDiscount = 530.00, meanbuyprice_withDiscount = 530.00
        , lastbuyprice_withTax = 530, meanbuyprice_withTax = 530, lastbuyprice_withDiscountAndTax = 530
                where sellbilldetailid = 1146;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (660, '2026-10-09', 2750, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2750, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2750, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2750, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '40', userid = '3', storedetaildate = '2026-10-09 14:08:42' WHERE storedetailid = '660';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('660', '1', '5', '1', '322', 'اضافة فاتورة مبيعات', 'sellbillController.php', '45', '40', '3', '2026-10-09 14:08:42','0','0'); -- id=4035
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('380','09457', '322', '25', '898', '5', '400', '2000', '0', '', '0', '2026-10-09 14:08:42', '898', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','400','2000','0','','0','0.00','0','0','0','0'); -- id=1147
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 1147;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (898, '2026-10-09', 2000, 1900, 1900
                    , 1900, 1900, 1900, 1900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1900, 1900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2000, sellCostBuyPrice =sellCostBuyPrice+1900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2000, 1900, 1900
                    , 1900, 1900, 1900, 1900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1900, 1900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2000, sellCostBuyPrice =sellCostBuyPrice+1900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '3', storedetaildate = '2026-10-09 14:08:42' WHERE storedetailid = '898';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('898', '1', '5', '1', '322', 'اضافة فاتورة مبيعات', 'sellbillController.php', '25', '20', '3', '2026-10-09 14:08:42','0','0'); -- id=4036
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 354;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','01466', '322', '104', '1466', '8', '370', '2960', '0', '', '0', '2026-10-09 14:08:42', '1466', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','354-8,','1','1','0','0','370','2960','0','','0','0.00','0','0','0','0'); -- id=1148
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 1148;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1466, '2026-10-09', 2960, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2960, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2960, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2960, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '448', userid = '3', storedetaildate = '2026-10-09 14:08:42' WHERE storedetailid = '1491';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1466', '1', '8', '1', '322', 'اضافة فاتورة مبيعات', 'sellbillController.php', '456', '448', '3', '2026-10-09 14:08:42','0','0'); -- id=4037
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 199;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('180','01450', '322', '101', '1450', '6', '200', '1200', '0', '', '0', '2026-10-09 14:08:42', '1450', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','199-6,','1','1','0','0','200','1200','0','','0','0.00','0','0','0','0'); -- id=1149
UPDATE sellbilldetail SET  lastbuyprice = 200.00 , meanbuyprice = 200.00, lastbuyprice_withDiscount = 180.00, meanbuyprice_withDiscount = 180.00
        , lastbuyprice_withTax = 200, meanbuyprice_withTax = 200, lastbuyprice_withDiscountAndTax = 180
                where sellbilldetailid = 1149;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1450, '2026-10-09', 1200, 1200, 1200
                    , 1200, 1080, 1080, 1080
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1200, 1200, 1200
                    , 1200, 1080, 1080, 1080
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 14:08:42' WHERE storedetailid = '1467';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1450', '1', '6', '1', '322', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '18', '3', '2026-10-09 14:08:42','0','0'); -- id=4038
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1873575',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1864665','8910', '0', '2', 'اضافة فاتورة مبيعات', '322', '1873575', '2026-10-09 14:08:42', '3',  'sellbillController.php','1','','0'); -- id=368
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '8910', '8910', '2026-10-09', '3', '0', '0', '2026-10-09 14:08:42','اضافة فاتورة مبيعات رقم 322','1','0',null,'0','322','sellbillController.php?do=showDetail&sellbillid=322'); -- id=1777
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1777', '419', '8910', '','0'); -- id=1808
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1873575', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1777', '143', '8910', '','0'); -- id=1777
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3387825', 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 ( '8030', '8030', '2026-10-09', '3', '0', '0', '2026-10-09 14:08:42','اضافة فاتورة مبيعات رقم 322 - صرف البضاعة من المخزن','1','0',null,'0','322','sellbillController.php?do=showDetail&sellbillid=322'); -- id=1778
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1778', '402', '8030', '','0'); -- id=1809
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3180390.95', 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 ('1778', '382', '8030', '','0'); -- id=1778
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19993857.25', 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='1777,0,1778' where sellbillid=322;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 8910, 8150, 8150
                    , 8150, 8030, 8030, 8030
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8150, 8150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8910, sellCostBuyPrice =sellCostBuyPrice+8150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8030, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8030
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8030
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 8910, 8150, 8150
                    , 8150, 8030, 8030, 8030
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8150, 8150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8910, sellCostBuyPrice =sellCostBuyPrice+8150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8030, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8030
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8030
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8150
                        , returnSellVal = returnSellVal+0, 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, 8910, 8150, 8150
                    , 8150, 8030, 8030, 8030, 8150, 8150)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+8910, netSellCostBuyPrice = netSellCostBuyPrice+8150
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+8150
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+8150
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+8030
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+8030
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+8030
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+8150
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+8150;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8c8b2c1b90 and sellbillId = 322 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:38:42";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:08:42", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:08:42', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5917
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:38:45";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:08:45", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:08:45', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=322'); -- id=5918
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:38:45";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:08:45", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:08:45', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=322'); -- id=5919
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:39:08";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:09:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:09:08', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5920
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:39:21";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:09:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:09:21', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5921
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:39:45";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:09:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:09:45', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5922
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:40:04";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:10:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storereportController.php', '2026-10-09 14:10:04', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storereportController.php'); -- id=5923
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:40:19";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:10:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storereportController.php', '2026-10-09 14:10:19', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storereportController.php?do=show'); -- id=5924
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:40:24";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:10:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 14:10:24', '1', 'oneSupplier', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=5925
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:40:30";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:10:30", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:10:30', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5926
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:40:30";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:10:30", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:10:30', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5927
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:40:40";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:10:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 14:10:40', '1', 'oneSupplier', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=5928
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:40:45";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:10:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 14:10:45', '1', 'editprint', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=editprint&id=119'); -- id=5929
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:41:02";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:11:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:11:02', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5930
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:41:10";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:11:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:11:10', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5931
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:41:22";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:11:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:11:22', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5932
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:41:29";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:11:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:11:29', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5933
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:41:30";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:11:30", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:11:30', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5934

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8c7555ed57
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 14:11:30', '06ac8c7555ed57', '1', '0.00', '0', '0', '1', '1650.00', '1650', '1650', '0', '2', '2026-10-09 14:11:30', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '3' ,'0','','','','','-1','0','0','0','0','0','1650','0','','0','0','1650','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=323
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','323', '0', '2026-10-09 14:11:30', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1650', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 14:11:30','0','0','',''); -- id=431
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 621;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('495','01722', '323', '49', '1722', '3', '550', '1650', '0', '', '0', '2026-10-09 14:11:30', '1722', '0.00', '0', '2','0.00','','','0','0','0','0','0','0','0','0','','621-3,','1','1','0','0','550','1650','0','','0','0.00','0','0','0','0'); -- id=1150
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 495.00, meanbuyprice_withDiscount = 495.00
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 495
                where sellbilldetailid = 1150;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1722, '2026-10-09', 1650, 1650, 1650
                    , 1650, 1485, 1485, 1485
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1485, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1485
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1485
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1650, 1650, 1650
                    , 1650, 1485, 1485, 1485
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1485, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1485
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1485
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '51', userid = '4', storedetaildate = '2026-10-09 14:11:30' WHERE storedetailid = '2735';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1722', '2', '3', '1', '323', 'اضافة فاتورة مبيعات', 'sellbillController.php', '54', '51', '4', '2026-10-09 14:11:30','0','0'); -- id=4039
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '440150',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('438500','1650', '0', '3', 'اضافة فاتورة مبيعات', '323', '440150', '2026-10-09 14:11:30', '4',  'sellbillController.php','1','','0'); -- id=369
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1650', '1650', '2026-10-09', '4', '0', '0', '2026-10-09 14:11:30','اضافة فاتورة مبيعات رقم 323','1','0',null,'0','323','sellbillController.php?do=showDetail&sellbillid=323'); -- id=1779
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1779', '501', '1650', '','0'); -- id=1810
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '440150', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1779', '143', '1650', '','0'); -- id=1779
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3389475', 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 ( '1485', '1485', '2026-10-09', '4', '0', '0', '2026-10-09 14:11:30','اضافة فاتورة مبيعات رقم 323 - صرف البضاعة من المخزن','1','0',null,'0','323','sellbillController.php?do=showDetail&sellbillid=323'); -- id=1780
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1780', '402', '1485', '','0'); -- id=1811
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3181875.95', 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 ('1780', '492', '1485', '','0'); -- id=1780
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '732275', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1779,0,1780' where sellbillid=323;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 1650, 1650, 1650
                    , 1650, 1485, 1485, 1485
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1485, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1485
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1485
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1650, 1650, 1650
                    , 1650, 1485, 1485, 1485
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1485, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1485
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1485
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, 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, 1650, 1650, 1650
                    , 1650, 1485, 1485, 1485, 1650, 1650)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1650, netSellCostBuyPrice = netSellCostBuyPrice+1650
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1650
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1650
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1485
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1485
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1485
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1650
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1650;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8c7555ed57 and sellbillId = 323 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:41:30";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:11:30", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:11:30', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5935
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:41:33";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:11:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 14:11:33', '1', 'oneSupplier', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=5936
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:41:40";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:11:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 14:11:40', '1', 'oneSupplier', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=5937
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:42:14";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:12:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 14:12:14', '1', 'bill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=5938
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:43:23";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:13:23", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:13:23', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5939
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:43:40";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:13:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 14:13:40', '1', 'oneSupplier', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=5940
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:43:47";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:13:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 14:13:47', '1', 'oneSupplier', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=5941
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:44:12";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:14:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:14:12', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5942
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:44:30";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:14:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:14:30', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5943
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:44:47";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:14:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storereportController.php', '2026-10-09 14:14:47', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storereportController.php'); -- id=5944
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:44:58";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:14:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('unitController.php', '2026-10-09 14:14:58', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/unitController.php?do=show'); -- id=5945
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:45:05";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:15:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 14:15:05', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php'); -- id=5946
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:45:05";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:15:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 14:15:05', '1', 'showallajax', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php?do=showallajax'); -- id=5947
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:45:08";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:15:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('salesreport.php', '2026-10-09 14:15:08', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/salesreport.php'); -- id=5948
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:45:11";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:15:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-09 14:15:11', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php'); -- id=5949
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:45:23";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:15:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-09 14:15:23', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php?do=show'); -- id=5950
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:45:49";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:15:49", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:15:49', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5951

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8cc535102b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 14:15:49', '06ac8cc535102b', '1', '0.00', '0', '0', '1', '11015.00', '3', '3', '0', '1', '2026-10-09 14:15:49', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '22' ,'0','','','','','-1','0','0','0','0','0','3','0','','0','0','3','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=324
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','324', '0', '2026-10-09 14:15:49', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 14:15:49','0','0','',''); -- id=432
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 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 ('535','01346', '324', '31', '1346', '6', '555', '3330', '0', '', '0', '2026-10-09 14:15:49', '1346', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','38-6,','1','1','0','0','555','3330','0','','0','0.00','0','0','0','0'); -- id=1151
UPDATE sellbilldetail SET  lastbuyprice = 535.00 , meanbuyprice = 535.00, lastbuyprice_withDiscount = 535.00, meanbuyprice_withDiscount = 535.00
        , lastbuyprice_withTax = 535, meanbuyprice_withTax = 535, lastbuyprice_withDiscountAndTax = 535
                where sellbilldetailid = 1151;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1346, '2026-10-09', 3330, 3210, 3210
                    , 3210, 3210, 3210, 3210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3210, 3210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3330, sellCostBuyPrice =sellCostBuyPrice+3210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3210
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3330, 3210, 3210
                    , 3210, 3210, 3210, 3210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3210, 3210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3330, sellCostBuyPrice =sellCostBuyPrice+3210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3210
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 14:15:49' WHERE storedetailid = '1346';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1346', '1', '6', '1', '324', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '18', '2', '2026-10-09 14:15:49','0','0'); -- id=4040
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('365','09666', '324', '30', '976', '5', '385', '1925', '0', '', '0', '2026-10-09 14:15:49', '976', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','385','1925','0','','0','0.00','0','0','0','0'); -- id=1152
UPDATE sellbilldetail SET  lastbuyprice = 365.00 , meanbuyprice = 365.00, lastbuyprice_withDiscount = 365.00, meanbuyprice_withDiscount = 365.00
        , lastbuyprice_withTax = 365, meanbuyprice_withTax = 365, lastbuyprice_withDiscountAndTax = 365
                where sellbilldetailid = 1152;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (976, '2026-10-09', 1925, 1825, 1825
                    , 1825, 1825, 1825, 1825
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1825, 1825, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1925, sellCostBuyPrice =sellCostBuyPrice+1825
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1825, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1825
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1825, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1825
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1825
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1825
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1825
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1925, 1825, 1825
                    , 1825, 1825, 1825, 1825
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1825, 1825, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1925, sellCostBuyPrice =sellCostBuyPrice+1825
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1825, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1825
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1825, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1825
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1825
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1825
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1825
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '105', userid = '2', storedetaildate = '2026-10-09 14:15:49' WHERE storedetailid = '976';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('976', '1', '5', '1', '324', 'اضافة فاتورة مبيعات', 'sellbillController.php', '110', '105', '2', '2026-10-09 14:15:49','0','0'); -- id=4041
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('490','09317', '324', '2', '1006', '6', '510', '3060', '0', '', '0', '2026-10-09 14:15:49', '1006', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','510','3060','0','','0','0.00','0','0','0','0'); -- id=1153
UPDATE sellbilldetail SET  lastbuyprice = 490.00 , meanbuyprice = 490.00, lastbuyprice_withDiscount = 490.00, meanbuyprice_withDiscount = 490.00
        , lastbuyprice_withTax = 490, meanbuyprice_withTax = 490, lastbuyprice_withDiscountAndTax = 490
                where sellbilldetailid = 1153;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1006, '2026-10-09', 3060, 2940, 2940
                    , 2940, 2940, 2940, 2940
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2940, 2940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3060, sellCostBuyPrice =sellCostBuyPrice+2940
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2940, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2940
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2940
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2940
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3060, 2940, 2940
                    , 2940, 2940, 2940, 2940
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2940, 2940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3060, sellCostBuyPrice =sellCostBuyPrice+2940
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2940, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2940
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2940
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2940
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '2', storedetaildate = '2026-10-09 14:15:49' WHERE storedetailid = '1006';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1006', '1', '6', '1', '324', 'اضافة فاتورة مبيعات', 'sellbillController.php', '25', '19', '2', '2026-10-09 14:15:49','0','0'); -- id=4042
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 65;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('520','01367', '324', '19', '1367', '5', '540', '2700', '0', '', '0', '2026-10-09 14:15:49', '1367', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','65-5,','1','1','0','0','540','2700','0','','0','0.00','0','0','0','0'); -- id=1154
UPDATE sellbilldetail SET  lastbuyprice = 520.00 , meanbuyprice = 520.00, lastbuyprice_withDiscount = 520.00, meanbuyprice_withDiscount = 520.00
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 520
                where sellbilldetailid = 1154;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1367, '2026-10-09', 2700, 2600, 2600
                    , 2600, 2600, 2600, 2600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2600, 2600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2700, 2600, 2600
                    , 2600, 2600, 2600, 2600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2600, 2600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '62', userid = '2', storedetaildate = '2026-10-09 14:15:49' WHERE storedetailid = '1367';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1367', '1', '5', '1', '324', 'اضافة فاتورة مبيعات', 'sellbillController.php', '67', '62', '2', '2026-10-09 14:15:49','0','0'); -- id=4043
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1873578',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1873575','3', '0', '2', 'اضافة فاتورة مبيعات', '324', '1873578', '2026-10-09 14:15:49', '2',  'sellbillController.php','1','','0'); -- id=370
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10575', '10575', '2026-10-09', '2', '0', '0', '2026-10-09 14:15:49','اضافة فاتورة مبيعات رقم 324 - صرف البضاعة من المخزن','1','0',null,'0','324','sellbillController.php?do=showDetail&sellbillid=324'); -- id=1781
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1781', '402', '10575', '','0'); -- id=1812
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3192450.95', 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 ('1781', '382', '10575', '','0'); -- id=1781
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '19983282.25', 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='0,0,1781' where sellbillid=324;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 11015, 10575, 10575
                    , 10575, 10575, 10575, 10575
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10575, 10575, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11015, sellCostBuyPrice =sellCostBuyPrice+10575
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10575, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10575
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10575, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10575
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10575
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10575
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10575
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 11015, 10575, 10575
                    , 10575, 10575, 10575, 10575
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10575, 10575, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11015, sellCostBuyPrice =sellCostBuyPrice+10575
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10575, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10575
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10575, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10575
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10575
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10575
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10575
                        , returnSellVal = returnSellVal+0, 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, 11015, 10575, 10575
                    , 10575, 10575, 10575, 10575, 10575, 10575)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+11015, netSellCostBuyPrice = netSellCostBuyPrice+10575
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+10575
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+10575
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+10575
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+10575
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+10575
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+10575
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+10575;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8cc535102b and sellbillId = 324 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:45:49";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:15:49", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:15:49', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5952
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:46:15";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:16:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:16:15', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5953
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:47:07";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:17:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 14:17:07', '1', 'add', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=5954
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 ('06ac8cc0e9769d', '2026-10-09 14:12:14', '119', '0.00', '82320', '0', '0', '82320.00',  '82320.00', '0', '82320', '1', '2026-10-09 14:17:07', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=93
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 ('01647', '93', '123', '1647', '24', '480', '11520.00', '0', '', '2026-10-09 14:17:07', '1647','','','0','0','0','0','0',null,'480','11520','0','0','0','0','0','0','0','0','1'); -- id=602
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1647, 0, 0
                    , 480, 24, 0, 0, 1, '2026-10-09 14:17:07')
                ON DUPLICATE KEY UPDATE buyprice = 480,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 14:17:07' ; -- id=768
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1647', '480', '24', '0', 'buyBillController.php', '602', '', '0', '0'); -- id=477
UPDATE product SET  productBuyPrice = "480" WHERE productId = 1647 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 602 ;
UPDATE product SET productName = 'تطريز صدر ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '480.00', productSellHalfPrice = '480.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01647',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '480',meanbuyprice = '480',meanbuyprice_withDiscount = '480' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',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='480',meanbuyprice_withTax='480',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='480',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1647';
UPDATE buybilldetail SET  lastbuyprice = 480 , meanbuyprice = 480, lastbuyprice_withDiscount = 480, meanbuyprice_withDiscount = 480
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 480, lastbuyprice_withDiscountAndTax = 480
                where buybilldetailid = 602;
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 1647;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1672';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1647', '1', '24', '0', '93', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:12:14','0','0'); -- id=4044
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 ('01648', '93', '123', '1648', '24', '480', '11520.00', '0', '', '2026-10-09 14:17:07', '1648','','','0','0','0','0','0',null,'480','11520','0','0','0','0','0','0','0','0','1'); -- id=603
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1648, 0, 0
                    , 480, 24, 0, 0, 1, '2026-10-09 14:17:07')
                ON DUPLICATE KEY UPDATE buyprice = 480,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 14:17:07' ; -- id=769
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1648', '480', '24', '0', 'buyBillController.php', '603', '', '0', '0'); -- id=478
UPDATE product SET  productBuyPrice = "480" WHERE productId = 1648 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 603 ;
UPDATE product SET productName = 'تطريز صدر و طباعه ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '480.00', productSellHalfPrice = '480.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01648',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '480',meanbuyprice = '480',meanbuyprice_withDiscount = '480' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',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='480',meanbuyprice_withTax='480',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='480',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1648';
UPDATE buybilldetail SET  lastbuyprice = 480 , meanbuyprice = 480, lastbuyprice_withDiscount = 480, meanbuyprice_withDiscount = 480
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 480, lastbuyprice_withDiscountAndTax = 480
                where buybilldetailid = 603;
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 1648;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1673';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1648', '1', '24', '0', '93', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:12:14','0','0'); -- id=4045
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 ('01649', '93', '123', '1649', '24', '480', '11520.00', '0', '', '2026-10-09 14:17:07', '1649','','','0','0','0','0','0',null,'480','11520','0','0','0','0','0','0','0','0','1'); -- id=604
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1649, 0, 0
                    , 480, 24, 0, 0, 1, '2026-10-09 14:17:07')
                ON DUPLICATE KEY UPDATE buyprice = 480,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 14:17:07' ; -- id=770
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1649', '480', '24', '0', 'buyBillController.php', '604', '', '0', '0'); -- id=479
UPDATE product SET  productBuyPrice = "480" WHERE productId = 1649 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 604 ;
UPDATE product SET productName = 'تطريز صدر وضهر ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '480.00', productSellHalfPrice = '480.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01649',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '480',meanbuyprice = '480',meanbuyprice_withDiscount = '480' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',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='480',meanbuyprice_withTax='480',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='480',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1649';
UPDATE buybilldetail SET  lastbuyprice = 480 , meanbuyprice = 480, lastbuyprice_withDiscount = 480, meanbuyprice_withDiscount = 480
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 480, lastbuyprice_withDiscountAndTax = 480
                where buybilldetailid = 604;
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 1649;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1674';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1649', '1', '24', '0', '93', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:12:14','0','0'); -- id=4046
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 ('01650', '93', '123', '1650', '24', '400', '9600.00', '0', '', '2026-10-09 14:17:07', '1650','','','0','0','0','0','0',null,'400','9600','0','0','0','0','0','0','0','0','1'); -- id=605
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1650, 0, 0
                    , 400, 24, 0, 0, 1, '2026-10-09 14:17:07')
                ON DUPLICATE KEY UPDATE buyprice = 400,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 14:17:07' ; -- id=771
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1650', '400', '24', '0', 'buyBillController.php', '605', '', '0', '0'); -- id=480
UPDATE product SET  productBuyPrice = "400" WHERE productId = 1650 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 605 ;
UPDATE product SET productName = 'طباعه ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '400.00', productSellAllPrice = '400.00', productSellUnitPrice = '400.00', productSellHalfPrice = '400.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01650',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '400',lastbuyprice_withDiscount = '400',meanbuyprice = '400',meanbuyprice_withDiscount = '400' , productbuypricereal = '400.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='400',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='400',meanbuyprice_withTax='400',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='400',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1650';
UPDATE buybilldetail SET  lastbuyprice = 400 , meanbuyprice = 400, lastbuyprice_withDiscount = 400, meanbuyprice_withDiscount = 400
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 400
                where buybilldetailid = 605;
UPDATE productunit SET proUnitBuyPrice  = 400 * productnumber WHERE productid = 1650;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1675';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1650', '1', '24', '0', '93', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:12:14','0','0'); -- id=4047
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 ('01651', '93', '123', '1651', '24', '410', '9840.00', '0', '', '2026-10-09 14:17:07', '1651','','','0','0','0','0','0',null,'410','9840','0','0','0','0','0','0','0','0','1'); -- id=606
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1651, 0, 0
                    , 410, 24, 0, 0, 1, '2026-10-09 14:17:07')
                ON DUPLICATE KEY UPDATE buyprice = 410,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 14:17:07' ; -- id=772
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1651', '410', '24', '0', 'buyBillController.php', '606', '', '0', '0'); -- id=481
UPDATE product SET  productBuyPrice = "410" WHERE productId = 1651 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 606 ;
UPDATE product SET productName = 'بوكس طباعه وسوسته ليزر2', productDescription = '', productCatId = '123', productBuyPrice = '410.00', productSellAllPrice = '410.00', productSellUnitPrice = '410.00', productSellHalfPrice = '410.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01651',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410',lastbuyprice_withDiscount = '410',meanbuyprice = '410',meanbuyprice_withDiscount = '410' , productbuypricereal = '410.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',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='410',meanbuyprice_withTax='410',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='410',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1651';
UPDATE buybilldetail SET  lastbuyprice = 410 , meanbuyprice = 410, lastbuyprice_withDiscount = 410, meanbuyprice_withDiscount = 410
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 410, lastbuyprice_withDiscountAndTax = 410
                where buybilldetailid = 606;
UPDATE productunit SET proUnitBuyPrice  = 410 * productnumber WHERE productid = 1651;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1676';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1651', '1', '24', '0', '93', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:12:14','0','0'); -- id=4048
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 ('01652', '93', '123', '1652', '24', '350', '8400.00', '0', '', '2026-10-09 14:17:07', '1652','','','0','0','0','0','0',null,'350','8400','0','0','0','0','0','0','0','0','1'); -- id=607
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1652, 0, 0
                    , 350, 24, 0, 0, 1, '2026-10-09 14:17:07')
                ON DUPLICATE KEY UPDATE buyprice = 350,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 14:17:07' ; -- id=773
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1652', '350', '24', '0', 'buyBillController.php', '607', '', '0', '0'); -- id=482
UPDATE product SET  productBuyPrice = "350" WHERE productId = 1652 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 607 ;
UPDATE product SET productName = 'حوض تطريز ليزر2', productDescription = '', productCatId = '123', productBuyPrice = '350.00', productSellAllPrice = '350.00', productSellUnitPrice = '350.00', productSellHalfPrice = '350.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01652',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',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='350',meanbuyprice_withTax='350',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='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1652';
UPDATE buybilldetail SET  lastbuyprice = 350 , meanbuyprice = 350, lastbuyprice_withDiscount = 350, meanbuyprice_withDiscount = 350
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where buybilldetailid = 607;
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 1652;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1677';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1652', '1', '24', '0', '93', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:12:14','0','0'); -- id=4049
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 ('01653', '93', '123', '1653', '24', '350', '8400.00', '0', '', '2026-10-09 14:17:07', '1653','','','0','0','0','0','0',null,'350','8400','0','0','0','0','0','0','0','0','1'); -- id=608
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1653, 0, 0
                    , 350, 24, 0, 0, 1, '2026-10-09 14:17:07')
                ON DUPLICATE KEY UPDATE buyprice = 350,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 14:17:07' ; -- id=774
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1653', '350', '24', '0', 'buyBillController.php', '608', '', '0', '0'); -- id=483
UPDATE product SET  productBuyPrice = "350" WHERE productId = 1653 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 608 ;
UPDATE product SET productName = 'حوض تطريز صدر و ضهر ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '350.00', productSellAllPrice = '350.00', productSellUnitPrice = '350.00', productSellHalfPrice = '350.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01653',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',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='350',meanbuyprice_withTax='350',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='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1653';
UPDATE buybilldetail SET  lastbuyprice = 350 , meanbuyprice = 350, lastbuyprice_withDiscount = 350, meanbuyprice_withDiscount = 350
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where buybilldetailid = 608;
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 1653;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1678';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1653', '1', '24', '0', '93', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:12:14','0','0'); -- id=4050
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 ('01654', '93', '123', '1654', '24', '480', '11520.00', '0', '', '2026-10-09 14:17:07', '1654','','','0','0','0','0','0',null,'480','11520','0','0','0','0','0','0','0','0','1'); -- id=609
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1654, 0, 0
                    , 480, 24, 0, 0, 1, '2026-10-09 14:17:07')
                ON DUPLICATE KEY UPDATE buyprice = 480,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 14:17:07' ; -- id=775
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1654', '480', '24', '0', 'buyBillController.php', '609', '', '0', '0'); -- id=484
UPDATE product SET  productBuyPrice = "480" WHERE productId = 1654 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 609 ;
UPDATE product SET productName = 'بوكس 2 زنط ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '480.00', productSellHalfPrice = '480.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01654',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '480',meanbuyprice = '480',meanbuyprice_withDiscount = '480' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',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='480',meanbuyprice_withTax='480',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='480',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1654';
UPDATE buybilldetail SET  lastbuyprice = 480 , meanbuyprice = 480, lastbuyprice_withDiscount = 480, meanbuyprice_withDiscount = 480
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 480, lastbuyprice_withDiscountAndTax = 480
                where buybilldetailid = 609;
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 1654;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1679';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1654', '1', '24', '0', '93', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:12:14','0','0'); -- id=4051
UPDATE supplier SET  suppliercurrentDebt = '82320',suppliercurrentDebtInCurrency= '82320' , userid = '1', supplierdate = '2026-10-09 14:17:07'   WHERE supplierid = '119';
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 ('119', '0.00', '82320', '0', 'اضافة فاتورة مشتريات', '93', '82320', '2026-10-09 14:12:14', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','82320','1','0','82320','82320','0',''); -- id=289
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '82320', '82320', '2026-10-09', '1', '0', '0', '2026-10-09 14:17:07','اضافة فاتورة مشتريات رقم 93','1','0',null,'0','93','buyBillController.php?do=details&id=93'); -- id=1782
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1782', '382', '82320', '','0'); -- id=1813
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20065602.25', 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 ('1782', '602', '82320', '','0'); -- id=1782
UPDATE accountstree SET name = 'ليزر 2', customName = 'ليزر 2', customNameEn = 'ليزر 2', nameEn = 'ليزر 2', parent = '81', accountNature = '1', theValue = '82320', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 10:40:45' WHERE id = '602';
update buybill set dailyentryid='1782,0' where buybillid=93;
COMMIT;
UPDATE product SET overAllAveragePrice = 480 WHERE productId = 1647;UPDATE product SET overAllAveragePrice = 480 WHERE productId = 1648;UPDATE product SET overAllAveragePrice = 480 WHERE productId = 1649;UPDATE product SET overAllAveragePrice = 400 WHERE productId = 1650;UPDATE product SET overAllAveragePrice = 410 WHERE productId = 1651;UPDATE product SET overAllAveragePrice = 350 WHERE productId = 1652;UPDATE product SET overAllAveragePrice = 350 WHERE productId = 1653;UPDATE product SET overAllAveragePrice = 480 WHERE productId = 1654;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:47:07";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:17:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 14:17:07', '1', 'editprint', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=93'); -- id=5955
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:47:21";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:17:21", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:17:21', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5956

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8cbe29b869
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 14:17:21', '06ac8cbe29b869', '1', '0.00', '0', '0', '1', '3300.00', '3300', '3300', '0', '2', '2026-10-09 14:17:21', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '6' ,'0','','','','','-1','0','0','0','0','0','3300','0','','0','0','3300','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=325
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','325', '0', '2026-10-09 14:17:21', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3300', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 14:17:21','0','0','',''); -- id=433
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 621;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('495','01722', '325', '49', '1722', '6', '550', '3300', '0', '', '0', '2026-10-09 14:17:21', '1722', '0.00', '0', '2','0.00','','','0','0','0','0','0','0','0','0','','621-6,','1','1','0','0','550','3300','0','','0','0.00','0','0','0','0'); -- id=1155
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 495.00, meanbuyprice_withDiscount = 495.00
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 495
                where sellbilldetailid = 1155;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1722, '2026-10-09', 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2970
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2970
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2970
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2970
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '45', userid = '4', storedetaildate = '2026-10-09 14:17:21' WHERE storedetailid = '2735';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1722', '2', '6', '1', '325', 'اضافة فاتورة مبيعات', 'sellbillController.php', '51', '45', '4', '2026-10-09 14:17:21','0','0'); -- id=4052
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '443450',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('440150','3300', '0', '3', 'اضافة فاتورة مبيعات', '325', '443450', '2026-10-09 14:17:21', '4',  'sellbillController.php','1','','0'); -- id=371
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3300', '3300', '2026-10-09', '4', '0', '0', '2026-10-09 14:17:21','اضافة فاتورة مبيعات رقم 325','1','0',null,'0','325','sellbillController.php?do=showDetail&sellbillid=325'); -- id=1783
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1783', '501', '3300', '','0'); -- id=1814
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '443450', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1783', '143', '3300', '','0'); -- id=1783
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3392775', 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 ( '2970', '2970', '2026-10-09', '4', '0', '0', '2026-10-09 14:17:21','اضافة فاتورة مبيعات رقم 325 - صرف البضاعة من المخزن','1','0',null,'0','325','sellbillController.php?do=showDetail&sellbillid=325'); -- id=1784
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1784', '402', '2970', '','0'); -- id=1815
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3195420.95', 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 ('1784', '492', '2970', '','0'); -- id=1784
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '729305', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1783,0,1784' where sellbillid=325;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2970
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2970
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2970
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2970
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, 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, 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970, 3300, 3300)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3300, netSellCostBuyPrice = netSellCostBuyPrice+3300
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3300
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3300
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2970
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2970
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2970
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3300
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3300;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8cbe29b869 and sellbillId = 325 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:47:22";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:17:22", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:17:22', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5957
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:47:59";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:17:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 14:18:00', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=5958
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:48:02";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:18:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 14:18:02', '1', 'editbill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=93'); -- id=5959
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:48:26";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:18:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:18:26', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=5960
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:51:10";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:21:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:21:10', '1', 'add', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=5961
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 ('موديل 1005 النونو','','126','440','440','440','440','2026-10-09','0','1','0','','0','0','0','0','0','440','440','440','440','440','0','0','0','0','.','0','0','0','440','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','440','440','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','440','0','0','0','0','0','0','','','0','0','0','0'); -- id=1794
UPDATE product SET productName = 'موديل 1005 النونو', productDescription = '', productCatId = '126', productBuyPrice = '440', productSellAllPrice = '440', productSellUnitPrice = '440', productSellHalfPrice = '440', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01794',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',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='440',meanbuyprice_withTax='440',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='440',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1794';
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', '1794', '1.00', '2026-10-09', '1', '0','0179401','440','440','440','440','','0','0','0','0','0','0','0','0','0','0'); -- id=1794
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1794', '1', '0', '1', '2026-10-09'); -- id=2807
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1794', '1', '0', '0', '1794', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4053
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1794, 1,'2026-10-09 14:21:10',1)
                ON DUPLICATE KEY UPDATE productid = 1794, edited = 1, sysdate = '2026-10-09 14:21:10', userid = 1; -- id=2711
UPDATE product SET productName = 'موديل 1005 النونو', productDescription = '', productCatId = '126', productBuyPrice = '440.00', productSellAllPrice = '440.00', productSellUnitPrice = '440.00', productSellHalfPrice = '440.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01794',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',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='440',meanbuyprice_withTax='440',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='440',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1794';
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 ('موديل 1008 النونو','','126','460','460','460','460','2026-10-09','0','1','0','','0','0','0','0','0','460','460','460','460','460','0','0','0','0','.','0','0','0','460','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','460','460','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','460','0','0','0','0','0','0','','','0','0','0','0'); -- id=1795
UPDATE product SET productName = 'موديل 1008 النونو', productDescription = '', productCatId = '126', productBuyPrice = '460', productSellAllPrice = '460', productSellUnitPrice = '460', productSellHalfPrice = '460', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01795',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '460',lastbuyprice_withDiscount = '460',meanbuyprice = '460',meanbuyprice_withDiscount = '460' , productbuypricereal = '460' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='460',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='460',meanbuyprice_withTax='460',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='460',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1795';
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', '1795', '1.00', '2026-10-09', '1', '0','0179501','460','460','460','460','','0','0','0','0','0','0','0','0','0','0'); -- id=1795
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1795', '1', '0', '1', '2026-10-09'); -- id=2808
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1795', '1', '0', '0', '1795', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4054
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1795, 1,'2026-10-09 14:21:10',1)
                ON DUPLICATE KEY UPDATE productid = 1795, edited = 1, sysdate = '2026-10-09 14:21:10', userid = 1; -- id=2712
UPDATE product SET productName = 'موديل 1008 النونو', productDescription = '', productCatId = '126', productBuyPrice = '460.00', productSellAllPrice = '460.00', productSellUnitPrice = '460.00', productSellHalfPrice = '460.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01795',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '460',lastbuyprice_withDiscount = '460',meanbuyprice = '460',meanbuyprice_withDiscount = '460' , productbuypricereal = '460' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='460',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='460',meanbuyprice_withTax='460',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='460',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1795';
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 ('موديل 450 النونو','','126','450','450','450','450','2026-10-09','0','1','0','','0','0','0','0','0','450','450','450','450','450','0','0','0','0','.','0','0','0','450','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','450','450','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','450','0','0','0','0','0','0','','','0','0','0','0'); -- id=1796
UPDATE product SET productName = 'موديل 450 النونو', productDescription = '', productCatId = '126', productBuyPrice = '450', productSellAllPrice = '450', productSellUnitPrice = '450', productSellHalfPrice = '450', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01796',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='450',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='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1796';
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', '1796', '1.00', '2026-10-09', '1', '0','0179601','450','450','450','450','','0','0','0','0','0','0','0','0','0','0'); -- id=1796
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1796', '1', '0', '1', '2026-10-09'); -- id=2809
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1796', '1', '0', '0', '1796', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4055
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1796, 1,'2026-10-09 14:21:10',1)
                ON DUPLICATE KEY UPDATE productid = 1796, edited = 1, sysdate = '2026-10-09 14:21:10', userid = 1; -- id=2713
UPDATE product SET productName = 'موديل 450 النونو', productDescription = '', productCatId = '126', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01796',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='450',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='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1796';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:51:18";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:21:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:21:18', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=5962
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:51:28";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:21:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 14:21:28', '1', 'bill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=5963
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:51:29";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:21:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 14:21:29', '1', 'bill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=5964
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:54:13";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:24:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:24:13', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5965
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:54:20";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:24:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:24:20', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5966
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:54:38";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:24:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:24:38', '1', 'show', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=5967
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:54:47";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:24:47", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 14:24:47', '4', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5968
UPDATE product SET productName = 'موديل 1007 النونو', productDescription = '', productCatId = '126', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01796',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450.00',lastbuyprice_withDiscount = '450',meanbuyprice = '450.00',meanbuyprice_withDiscount = '450' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='450',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='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1796';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1796, 1,'2026-10-09 14:25:14',1)
                ON DUPLICATE KEY UPDATE productid = 1796, edited = 1, sysdate = '2026-10-09 14:25:14', userid = 1; -- id=2713
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:56:57";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:26:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 14:26:57', '1', 'add', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=5969
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 ('06ac8ce39e16b8', '2026-10-09 14:21:29', '122', '69331.20', '101623.2', '8', '1', '35100.00',  '32292.00', '0', '32292', '1', '2026-10-09 14:26:57', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=94
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 ('01794', '94', '126', '1794', '24', '440', '10560.00', '0', '', '2026-10-09 14:26:57', '1794','','','0','0','0','0','0',null,'440','10560','0','0','0','0','0','0','0','0','1'); -- id=610
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:21:29', 1, 1794, 0, 0
                    , 404.8, 24, 0, 0, 1, '2026-10-09 14:26:57')
                ON DUPLICATE KEY UPDATE buyprice = 404.8,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 14:26:57' ; -- id=776
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1794', '440', '24', '0', 'buyBillController.php', '610', '', '0', '0'); -- id=485
UPDATE product SET  productBuyPrice = "440" WHERE productId = 1794 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 610 ;
UPDATE product SET productName = 'موديل 1005 النونو', productDescription = '', productCatId = '126', productBuyPrice = '440.00', productSellAllPrice = '440.00', productSellUnitPrice = '440.00', productSellHalfPrice = '440.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01794',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '404.8',meanbuyprice = '440',meanbuyprice_withDiscount = '404.8' , productbuypricereal = '440.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',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='440',meanbuyprice_withTax='440',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='404.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 = '1794';
UPDATE buybilldetail SET  lastbuyprice = 440 , meanbuyprice = 440, lastbuyprice_withDiscount = 404.8, meanbuyprice_withDiscount = 404.8
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 404.8
                where buybilldetailid = 610;
UPDATE productunit SET proUnitBuyPrice  = 440 * productnumber WHERE productid = 1794;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2807';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1794', '1', '24', '0', '94', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:21:29','0','0'); -- id=4056
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 ('01795', '94', '126', '1795', '24', '460', '11040.00', '0', '', '2026-10-09 14:26:57', '1795','','','0','0','0','0','0',null,'460','11040','0','0','0','0','0','0','0','0','1'); -- id=611
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:21:29', 1, 1795, 0, 0
                    , 423.2, 24, 0, 0, 1, '2026-10-09 14:26:57')
                ON DUPLICATE KEY UPDATE buyprice = 423.2,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 14:26:57' ; -- id=777
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1795', '460', '24', '0', 'buyBillController.php', '611', '', '0', '0'); -- id=486
UPDATE product SET  productBuyPrice = "460" WHERE productId = 1795 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 611 ;
UPDATE product SET productName = 'موديل 1008 النونو', productDescription = '', productCatId = '126', productBuyPrice = '460.00', productSellAllPrice = '460.00', productSellUnitPrice = '460.00', productSellHalfPrice = '460.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01795',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '460',lastbuyprice_withDiscount = '423.2',meanbuyprice = '460',meanbuyprice_withDiscount = '423.2' , productbuypricereal = '460.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='460',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='460',meanbuyprice_withTax='460',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='423.2',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1795';
UPDATE buybilldetail SET  lastbuyprice = 460 , meanbuyprice = 460, lastbuyprice_withDiscount = 423.2, meanbuyprice_withDiscount = 423.2
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 423.2
                where buybilldetailid = 611;
UPDATE productunit SET proUnitBuyPrice  = 460 * productnumber WHERE productid = 1795;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2808';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1795', '1', '24', '0', '94', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:21:29','0','0'); -- id=4057
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 ('01796', '94', '126', '1796', '30', '450', '13500.00', '0', '', '2026-10-09 14:26:57', '1796','','','0','0','0','0','0',null,'450','13500','0','0','0','0','0','0','0','0','1'); -- id=612
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:21:29', 1, 1796, 0, 0
                    , 414, 30, 0, 0, 1, '2026-10-09 14:26:57')
                ON DUPLICATE KEY UPDATE buyprice = 414,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 14:26:57' ; -- id=778
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1796', '450', '30', '0', 'buyBillController.php', '612', '', '0', '0'); -- id=487
UPDATE product SET  productBuyPrice = "450" WHERE productId = 1796 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 612 ;
UPDATE product SET productName = 'موديل 1007 النونو', productDescription = '', productCatId = '126', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01796',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '414',meanbuyprice = '450',meanbuyprice_withDiscount = '414' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='450',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='414',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1796';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 414, meanbuyprice_withDiscount = 414
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where buybilldetailid = 612;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 1796;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2809';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1796', '1', '30', '0', '94', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '1', '2026-10-09 14:21:29','0','0'); -- id=4058
UPDATE supplier SET  suppliercurrentDebt = '101623.2',suppliercurrentDebtInCurrency= '101623.2' , userid = '1', supplierdate = '2026-10-09 14:26:57'   WHERE supplierid = '122';
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 ('122', '69331.20', '32292', '0', 'اضافة فاتورة مشتريات', '94', '101623.2', '2026-10-09 14:21:29', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','32292','1','69331.2','32292','101623.2','0',''); -- id=290
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '32292', '32292', '2026-10-09', '1', '0', '0', '2026-10-09 14:26:57','اضافة فاتورة مشتريات رقم 94','1','0',null,'0','94','buyBillController.php?do=details&id=94'); -- id=1785
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1785', '382', '32292', '','0'); -- id=1816
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20097894.25', 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 ('1785', '605', '32292', '','0'); -- id=1785
UPDATE accountstree SET name = 'النونو', customName = 'النونو', customNameEn = 'النونو', nameEn = 'النونو', parent = '81', accountNature = '1', theValue = '101623.2', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 11:42:01' WHERE id = '605';
update buybill set dailyentryid='1785,0' where buybillid=94;
COMMIT;
UPDATE product SET overAllAveragePrice = 404.8 WHERE productId = 1794;UPDATE product SET overAllAveragePrice = 423.2 WHERE productId = 1795;UPDATE product SET overAllAveragePrice = 414 WHERE productId = 1796;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:56:58";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:26:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 14:26:58', '1', 'editprint', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=94'); -- id=5970
UPDATE product SET productName = '101 - 102 النونو', productDescription = '', productCatId = '126', productBuyPrice = '410.00', productSellAllPrice = '410.00', productSellUnitPrice = '410.00', productSellHalfPrice = '410.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01687',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410.00',lastbuyprice_withDiscount = '377.2',meanbuyprice = '410.00',meanbuyprice_withDiscount = '377.2' , productbuypricereal = '410.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='377.2',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='410',meanbuyprice_withTax='410',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='377.2',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1687';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1687, 1,'2026-10-09 14:27:04',1)
                ON DUPLICATE KEY UPDATE productid = 1687, edited = 1, sysdate = '2026-10-09 14:27:04', userid = 1; -- id=2526
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:57:20";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:27:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 14:27:20', '1', 'showbarcodebuybill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=94&type=2'); -- id=5971
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:57:41";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:27:41", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:27:41', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5972
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:58:00";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:28:00", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:28:00', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5973
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:58:01";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:28:01", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 14:28:01', '4', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=5974
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:58:13";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:28:13", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:28:13', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5975
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:58:39";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:28:39", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:28:39', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5976

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8cce5aa155
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 14:28:40', '06ac8cce5aa155', '1', '0.00', '0', '0', '1', '10950.00', '10950', '10950', '0', '1', '2026-10-09 14:28:40', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '27' ,'0','','','','','-1','0','0','0','0','0','10950','0','','0','0','10950','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=326
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','326', '0', '2026-10-09 14:28:40', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10950', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 14:28:40','0','0','',''); -- id=434
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 559;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('386.4','01695', '326', '127', '1695', '6', '420', '2520', '0', '', '0', '2026-10-09 14:28:40', '1695', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','559-6,','1','1','0','0','420','2520','0','','0','0.00','0','0','0','0'); -- id=1156
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 420.00, lastbuyprice_withDiscount = 386.40, meanbuyprice_withDiscount = 386.40
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 386.4
                where sellbilldetailid = 1156;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1695, '2026-10-09', 2520, 2520, 2520
                    , 2520, 2318.4, 2318.4, 2318.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2520, 2520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2318.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2318.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2318.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2520, 2520, 2520
                    , 2520, 2318.4, 2318.4, 2318.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2520, 2520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2318.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2318.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2318.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '153', userid = '2', storedetaildate = '2026-10-09 14:28:40' WHERE storedetailid = '2707';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1695', '1', '6', '1', '326', 'اضافة فاتورة مبيعات', 'sellbillController.php', '159', '153', '2', '2026-10-09 14:28:40','0','0'); -- id=4059
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 211;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('420','01430', '326', '100', '1430', '6', '450', '2700', '0', '', '0', '2026-10-09 14:28:40', '1430', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','211-6,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=1157
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 417.50, lastbuyprice_withDiscount = 420.00, meanbuyprice_withDiscount = 417.50
        , lastbuyprice_withTax = 417.5, meanbuyprice_withTax = 417.5, lastbuyprice_withDiscountAndTax = 420
                where sellbilldetailid = 1157;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1430, '2026-10-09', 2700, 2490, 2520
                    , 2505, 2520, 2505, 2520
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2505, 2505, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2490
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2505
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2505
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2505
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2505
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2700, 2490, 2520
                    , 2505, 2520, 2505, 2520
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2505, 2505, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2490
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2505
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2505
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2505
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2505
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '2', storedetaildate = '2026-10-09 14:28:40' WHERE storedetailid = '1443';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1430', '1', '6', '1', '326', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '27', '2', '2026-10-09 14:28:40','0','0'); -- id=4060
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 328;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','01458', '326', '103', '1458', '6', '320', '1920', '0', '', '0', '2026-10-09 14:28:40', '1458', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','328-6,','1','1','0','0','320','1920','0','','0','0.00','0','0','0','0'); -- id=1158
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 1158;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1458, '2026-10-09', 1920, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1920, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1920, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1920, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '18', userid = '2', storedetaildate = '2026-10-09 14:28:40' WHERE storedetailid = '1483';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1458', '1', '6', '1', '326', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '18', '2', '2026-10-09 14:28:40','0','0'); -- id=4061
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 332;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('410','01462', '326', '103', '1462', '3', '430', '1290', '0', '', '0', '2026-10-09 14:28:40', '1462', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','332-3,','1','1','0','0','430','1290','0','','0','0.00','0','0','0','0'); -- id=1159
UPDATE sellbilldetail SET  lastbuyprice = 410.00 , meanbuyprice = 410.00, lastbuyprice_withDiscount = 410.00, meanbuyprice_withDiscount = 410.00
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 410, lastbuyprice_withDiscountAndTax = 410
                where sellbilldetailid = 1159;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1462, '2026-10-09', 1290, 1230, 1230
                    , 1230, 1230, 1230, 1230
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1230, 1230, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1290, sellCostBuyPrice =sellCostBuyPrice+1230
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1230, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1230
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1230, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1230
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1230
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1230
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1230
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1290, 1230, 1230
                    , 1230, 1230, 1230, 1230
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1230, 1230, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1290, sellCostBuyPrice =sellCostBuyPrice+1230
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1230, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1230
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1230, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1230
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1230
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1230
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1230
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '213', userid = '2', storedetaildate = '2026-10-09 14:28:40' WHERE storedetailid = '1487';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1462', '1', '3', '1', '326', 'اضافة فاتورة مبيعات', 'sellbillController.php', '216', '213', '2', '2026-10-09 14:28:40','0','0'); -- id=4062
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 558;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('322','01694', '326', '127', '1694', '3', '350', '1050', '0', '', '0', '2026-10-09 14:28:40', '1694', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','558-3,','1','1','0','0','350','1050','0','','0','0.00','0','0','0','0'); -- id=1160
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 322.00, meanbuyprice_withDiscount = 322.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 322
                where sellbilldetailid = 1160;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1694, '2026-10-09', 1050, 1050, 1050
                    , 1050, 966, 966, 966
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1050, 1050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+966, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+966
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+966
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1050, 1050, 1050
                    , 1050, 966, 966, 966
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1050, 1050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+966, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+966
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+966
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '2', storedetaildate = '2026-10-09 14:28:40' WHERE storedetailid = '2706';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1694', '1', '3', '1', '326', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '12', '2', '2026-10-09 14:28:40','0','0'); -- id=4063
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 543;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('441','01641', '326', '122', '1641', '3', '490', '1470', '0', '', '0', '2026-10-09 14:28:40', '1641', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','543-3,','1','1','0','0','490','1470','0','','0','0.00','0','0','0','0'); -- id=1161
UPDATE sellbilldetail SET  lastbuyprice = 490.00 , meanbuyprice = 490.00, lastbuyprice_withDiscount = 441.00, meanbuyprice_withDiscount = 441.00
        , lastbuyprice_withTax = 490, meanbuyprice_withTax = 490, lastbuyprice_withDiscountAndTax = 441
                where sellbilldetailid = 1161;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1641, '2026-10-09', 1470, 1470, 1470
                    , 1470, 1323, 1323, 1323
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1470, 1470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1470, sellCostBuyPrice =sellCostBuyPrice+1470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1470, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1323, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1323
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1323
                            , 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+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1470, 1470, 1470
                    , 1470, 1323, 1323, 1323
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1470, 1470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1470, sellCostBuyPrice =sellCostBuyPrice+1470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1470, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1323, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1323
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1323
                            , 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 = '12', userid = '2', storedetaildate = '2026-10-09 14:28:40' WHERE storedetailid = '1666';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1641', '1', '3', '1', '326', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '12', '2', '2026-10-09 14:28:40','0','0'); -- id=4064
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1884528',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1873578','10950', '0', '2', 'اضافة فاتورة مبيعات', '326', '1884528', '2026-10-09 14:28:40', '2',  'sellbillController.php','1','','0'); -- id=372
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10950', '10950', '2026-10-09', '2', '0', '0', '2026-10-09 14:28:40','اضافة فاتورة مبيعات رقم 326','1','0',null,'0','326','sellbillController.php?do=showDetail&sellbillid=326'); -- id=1786
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1786', '419', '10950', '','0'); -- id=1817
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1884525', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1786', '143', '10950', '','0'); -- id=1786
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3403725', 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 ( '10157.4', '10157.4', '2026-10-09', '2', '0', '0', '2026-10-09 14:28:40','اضافة فاتورة مبيعات رقم 326 - صرف البضاعة من المخزن','1','0',null,'0','326','sellbillController.php?do=showDetail&sellbillid=326'); -- id=1787
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1787', '402', '10157.4', '','0'); -- id=1818
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3205578.35', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1787', '382', '10157.4', '','0'); -- id=1787
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20087736.85', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1786,0,1787' where sellbillid=326;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 10950, 10560, 10590
                    , 10575, 10157.4, 10142.4, 10157.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10575, 10575, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10950, sellCostBuyPrice =sellCostBuyPrice+10560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10590, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10575
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10157.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10142.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10157.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10575
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10575
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 10950, 10560, 10590
                    , 10575, 10157.4, 10142.4, 10157.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10575, 10575, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10950, sellCostBuyPrice =sellCostBuyPrice+10560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10590, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10575
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10157.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10142.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10157.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10575
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10575
                        , returnSellVal = returnSellVal+0, 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, 10950, 10560, 10590
                    , 10575, 10157.4, 10142.4, 10157.4, 10575, 10575)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10950, netSellCostBuyPrice = netSellCostBuyPrice+10560
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+10590
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+10575
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+10157.4
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+10142.4
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+10157.4
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+10575
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+10575;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8cce5aa155 and sellbillId = 326 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 10:58:40";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:28:40", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:28:40', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5977
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:00:00";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:00:04";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:30:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 14:30:04', '1', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5978
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:00:04";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 14:30:04', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5979
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:00:08";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:30:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 14:30:08', '1', 'bill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=5980
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:02:07";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:32:07", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:32:07', '6', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5981

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8c81ee7c49
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 14:32:07', '06ac8c81ee7c49', '1', '0.00', '0', '0', '1', '6000.00', '6000', '6000', '0', '1', '2026-10-09 14:32:07', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '12' ,'0','','','','','-1','0','0','0','0','0','6000','0','','0','0','6000','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=327
UPDATE client SET  clientdebt = '0', userid = '6' 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','اضافة فاتورة مبيعات','327', '0', '2026-10-09 14:32:07', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '6000', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 14:32:07','0','0','',''); -- id=435
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 55;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('440','01370', '327', '91', '1370', '6', '500', '3000', '0', '', '0', '2026-10-09 14:32:07', '1370', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','55-6,','1','1','0','0','500','3000','0','','0','0.00','0','0','0','0'); -- id=1162
UPDATE sellbilldetail SET  lastbuyprice = 440.00 , meanbuyprice = 440.00, lastbuyprice_withDiscount = 440.00, meanbuyprice_withDiscount = 440.00
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 440
                where sellbilldetailid = 1162;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1370, '2026-10-09', 3000, 2640, 2640
                    , 2640, 2640, 2640, 2640
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2640, 2640, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2640, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2640
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2640
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2640
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3000, 2640, 2640
                    , 2640, 2640, 2640, 2640
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2640, 2640, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2640, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2640
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2640
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2640
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '69', userid = '6', storedetaildate = '2026-10-09 14:32:07' WHERE storedetailid = '1370';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1370', '1', '6', '1', '327', 'اضافة فاتورة مبيعات', 'sellbillController.php', '75', '69', '6', '2026-10-09 14:32:07','0','0'); -- id=4065
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 342;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('480','01498', '327', '108', '1498', '6', '500', '3000', '0', '', '0', '2026-10-09 14:32:07', '1498', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','342-6,','1','1','0','0','500','3000','0','','0','0.00','0','0','0','0'); -- id=1163
UPDATE sellbilldetail SET  lastbuyprice = 480.00 , meanbuyprice = 480.00, lastbuyprice_withDiscount = 480.00, meanbuyprice_withDiscount = 480.00
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 480, lastbuyprice_withDiscountAndTax = 480
                where sellbilldetailid = 1163;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1498, '2026-10-09', 3000, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3000, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '6', storedetaildate = '2026-10-09 14:32:07' WHERE storedetailid = '1523';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1498', '1', '6', '1', '327', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '12', '6', '2026-10-09 14:32:07','0','0'); -- id=4066
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '84545',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('78545','6000', '0', '4', 'اضافة فاتورة مبيعات', '327', '84545', '2026-10-09 14:32:07', '6',  'sellbillController.php','1','','0'); -- id=373
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6000', '6000', '2026-10-09', '6', '0', '0', '2026-10-09 14:32:07','اضافة فاتورة مبيعات رقم 327','1','0',null,'0','327','sellbillController.php?do=showDetail&sellbillid=327'); -- id=1788
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1788', '568', '6000', '','0'); -- id=1819
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '84545', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1788', '143', '6000', '','0'); -- id=1788
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3409725', 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 ( '5520', '5520', '2026-10-09', '6', '0', '0', '2026-10-09 14:32:07','اضافة فاتورة مبيعات رقم 327 - صرف البضاعة من المخزن','1','0',null,'0','327','sellbillController.php?do=showDetail&sellbillid=327'); -- id=1789
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1789', '402', '5520', '','0'); -- id=1820
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3211098.35', 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 ('1789', '382', '5520', '','0'); -- id=1789
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20082216.85', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1788,0,1789' where sellbillid=327;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 6000, 5520, 5520
                    , 5520, 5520, 5520, 5520
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5520, 5520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+5520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 6000, 5520, 5520
                    , 5520, 5520, 5520, 5520
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5520, 5520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+5520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5520
                        , returnSellVal = returnSellVal+0, 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, 6000, 5520, 5520
                    , 5520, 5520, 5520, 5520, 5520, 5520)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6000, netSellCostBuyPrice = netSellCostBuyPrice+5520
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5520
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5520
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5520
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5520
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5520
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5520
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5520;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8c81ee7c49 and sellbillId = 327 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:02:07";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:32:07", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:32:07', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5982
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:05:39";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:35:39", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:35:39', '2', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5983

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8cfe849a00
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 14:35:39', '06ac8cfe849a00', '1', '0.00', '0', '0', '1', '5100.00', '5100', '5100', '0', '1', '2026-10-09 14:35:39', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '12' ,'0','','','','','-1','0','0','0','0','0','5100','0','','0','0','5100','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=328
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','328', '0', '2026-10-09 14:35:39', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '5100', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 14:35:39','0','0','',''); -- id=436
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 74;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','01382', '328', '94', '1382', '6', '400', '2400', '0', '', '0', '2026-10-09 14:35:39', '1382', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','74-6,','1','1','0','0','400','2400','0','','0','0.00','0','0','0','0'); -- id=1164
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1164;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1382, '2026-10-09', 2400, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2400, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '69', userid = '2', storedetaildate = '2026-10-09 14:35:39' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '6', '1', '328', 'اضافة فاتورة مبيعات', 'sellbillController.php', '75', '69', '2', '2026-10-09 14:35:39','0','0'); -- id=4067
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 327;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','01457', '328', '103', '1457', '6', '450', '2700', '0', '', '0', '2026-10-09 14:35:39', '1457', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','327-6,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=1165
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 1165;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1457, '2026-10-09', 2700, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2700, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '6', userid = '2', storedetaildate = '2026-10-09 14:35:39' WHERE storedetailid = '1482';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1457', '1', '6', '1', '328', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '6', '2', '2026-10-09 14:35:39','0','0'); -- id=4068
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1889628',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1884528','5100', '0', '2', 'اضافة فاتورة مبيعات', '328', '1889628', '2026-10-09 14:35:39', '2',  'sellbillController.php','1','','0'); -- id=374
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5100', '5100', '2026-10-09', '2', '0', '0', '2026-10-09 14:35:39','اضافة فاتورة مبيعات رقم 328','1','0',null,'0','328','sellbillController.php?do=showDetail&sellbillid=328'); -- id=1790
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1790', '419', '5100', '','0'); -- id=1821
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1889625', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1790', '143', '5100', '','0'); -- id=1790
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3414825', 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 ( '4740', '4740', '2026-10-09', '2', '0', '0', '2026-10-09 14:35:39','اضافة فاتورة مبيعات رقم 328 - صرف البضاعة من المخزن','1','0',null,'0','328','sellbillController.php?do=showDetail&sellbillid=328'); -- id=1791
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1791', '402', '4740', '','0'); -- id=1822
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3215838.35', 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 ('1791', '382', '4740', '','0'); -- id=1791
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20077476.85', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1790,0,1791' where sellbillid=328;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 5100, 4740, 4740
                    , 4740, 4740, 4740, 4740
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4740, 4740, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5100, sellCostBuyPrice =sellCostBuyPrice+4740
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4740, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4740
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4740, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4740
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4740
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4740
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4740
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5100, 4740, 4740
                    , 4740, 4740, 4740, 4740
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4740, 4740, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5100, sellCostBuyPrice =sellCostBuyPrice+4740
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4740, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4740
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4740, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4740
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4740
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4740
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4740
                        , returnSellVal = returnSellVal+0, 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, 5100, 4740, 4740
                    , 4740, 4740, 4740, 4740, 4740, 4740)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5100, netSellCostBuyPrice = netSellCostBuyPrice+4740
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+4740
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+4740
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+4740
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+4740
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+4740
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+4740
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+4740;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8cfe849a00 and sellbillId = 328 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:05:40";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:35:40", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:35:40', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5984
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:05:55";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:35:55", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:35:55', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5985

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8cba648be4
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8cba648be4 and sellbillId = 329 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:05:59";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:35:59", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:35:59', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5986
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:06:02";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:36:02", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:36:02', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=329'); -- id=5987
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:06:42";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:36:42", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:36:42', '2', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=328'); -- id=5988
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:06:53";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:36:53", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:36:53', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5989
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:07:16";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:37:16", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:37:16', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5990
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:07:27";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:37:27", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 14:37:27', '2', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5991
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:07:27";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 14:37:27", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 14:37:27', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5992
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:07:32";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:37:32", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:37:32', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5993
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:08:12";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:38:12", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 14:38:12', '2', '', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=5994
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:08:12";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 14:38:12", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 14:38:12', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=5995
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:08:16";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:38:16", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:38:16', '2', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5996
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:16:45";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:46:45", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:46:45', '4', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5997

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8cfcd2891b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 14:46:45', '06ac8cfcd2891b', '1', '0.00', '0', '0', '1', '4720.00', '4720', '4720', '0', '2', '2026-10-09 14:46:45', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '12' ,'0','','','','','-1','0','0','0','0','0','4720','0','','0','0','4720','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=330
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','330', '0', '2026-10-09 14:46:45', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '4720', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 14:46:45','0','0','',''); -- id=438
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01324', '330', '86', '1324', '8', '390', '3120', '0', '', '0', '2026-10-09 14:46:45', '1324', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','131-8,','1','1','0','0','390','3120','0','','0','0.00','0','0','0','0'); -- id=1167
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1167;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1324, '2026-10-09', 3120, 2800, 2800
                    , 2800, 2800, 2800, 2800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3120, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 3120, 2800, 2800
                    , 2800, 2800, 2800, 2800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3120, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '688', userid = '4', storedetaildate = '2026-10-09 14:46:45' WHERE storedetailid = '1405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '2', '8', '1', '330', 'اضافة فاتورة مبيعات', 'sellbillController.php', '696', '688', '4', '2026-10-09 14:46:45','0','0'); -- id=4070
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 151;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('380','01358', '330', '88', '1358', '4', '400', '1600', '0', '', '0', '2026-10-09 14:46:45', '1358', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','151-4,','1','1','0','0','400','1600','0','','0','0.00','0','0','0','0'); -- id=1168
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 1168;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1358, '2026-10-09', 1600, 1520, 1520
                    , 1520, 1520, 1520, 1520
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1520, 1520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1600, sellCostBuyPrice =sellCostBuyPrice+1520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1600, 1520, 1520
                    , 1520, 1520, 1520, 1520
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1520, 1520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1600, sellCostBuyPrice =sellCostBuyPrice+1520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '4', storedetaildate = '2026-10-09 14:46:45' WHERE storedetailid = '1415';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1358', '2', '4', '1', '330', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '16', '4', '2026-10-09 14:46:45','0','0'); -- id=4071
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '448170',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('443450','4720', '0', '3', 'اضافة فاتورة مبيعات', '330', '448170', '2026-10-09 14:46:45', '4',  'sellbillController.php','1','','0'); -- id=376
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4720', '4720', '2026-10-09', '4', '0', '0', '2026-10-09 14:46:45','اضافة فاتورة مبيعات رقم 330','1','0',null,'0','330','sellbillController.php?do=showDetail&sellbillid=330'); -- id=1794
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1794', '501', '4720', '','0'); -- id=1825
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '448170', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1794', '143', '4720', '','0'); -- id=1794
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3421945', 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 ( '4320', '4320', '2026-10-09', '4', '0', '0', '2026-10-09 14:46:45','اضافة فاتورة مبيعات رقم 330 - صرف البضاعة من المخزن','1','0',null,'0','330','sellbillController.php?do=showDetail&sellbillid=330'); -- id=1795
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1795', '402', '4320', '','0'); -- id=1826
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3222318.35', 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 ('1795', '492', '4320', '','0'); -- id=1795
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '724985', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1794,0,1795' where sellbillid=330;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 4720, 4320, 4320
                    , 4320, 4320, 4320, 4320
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4320, 4320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4720, sellCostBuyPrice =sellCostBuyPrice+4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4320
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4720, 4320, 4320
                    , 4320, 4320, 4320, 4320
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4320, 4320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4720, sellCostBuyPrice =sellCostBuyPrice+4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4320
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4320
                        , returnSellVal = returnSellVal+0, 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, 4720, 4320, 4320
                    , 4320, 4320, 4320, 4320, 4320, 4320)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+4720, netSellCostBuyPrice = netSellCostBuyPrice+4320
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+4320
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+4320
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+4320
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+4320
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+4320
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+4320
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+4320;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8cfcd2891b and sellbillId = 330 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:16:46";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:46:46", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:46:46', '4', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=5998
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:21:51";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:51:51", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:51:51', '3', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=5999

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8d1ecf3fd1
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 14:51:51', '06ac8d1ecf3fd1', '1', '0.00', '0', '0', '1', '15470.00', '15470', '15470', '0', '1', '2026-10-09 14:51:51', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '38' ,'0','','','','','-1','0','0','0','0','0','15470','0','','0','0','15470','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=331
UPDATE client SET  clientdebt = '0', userid = '3' 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','اضافة فاتورة مبيعات','331', '0', '2026-10-09 14:51:51', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '15470', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 14:51:51','0','0','',''); -- id=439
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 503;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('334.8','01657', '331', '125', '1657', '3', '360', '1080', '0', '', '0', '2026-10-09 14:51:51', '1657', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','503-3,','1','1','0','0','360','1080','0','','0','0.00','0','0','0','0'); -- id=1169
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 334.80, meanbuyprice_withDiscount = 334.80
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 334.8
                where sellbilldetailid = 1169;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1657, '2026-10-09', 1080, 1080, 1080
                    , 1080, 1004.4, 1004.4, 1004.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1004.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1004.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1004.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1080, 1080, 1080
                    , 1080, 1004.4, 1004.4, 1004.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1004.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1004.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1004.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '141', userid = '3', storedetaildate = '2026-10-09 14:51:51' WHERE storedetailid = '2669';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1657', '1', '3', '1', '331', 'اضافة فاتورة مبيعات', 'sellbillController.php', '144', '141', '3', '2026-10-09 14:51:51','0','0'); -- id=4072
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 501;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('344.1','01656', '331', '125', '1656', '6', '370', '2220', '0', '', '0', '2026-10-09 14:51:51', '1656', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','501-6,','1','1','0','0','370','2220','0','','0','0.00','0','0','0','0'); -- id=1170
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 344.10, meanbuyprice_withDiscount = 344.10
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 344.1
                where sellbilldetailid = 1170;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1656, '2026-10-09', 2220, 2220, 2220
                    , 2220, 2064.6, 2064.6, 2064.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2220, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2064.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2064.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2064.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2220, 2220, 2220
                    , 2220, 2064.6, 2064.6, 2064.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2220, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2064.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2064.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2064.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '90', userid = '3', storedetaildate = '2026-10-09 14:51:51' WHERE storedetailid = '2668';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1656', '1', '6', '1', '331', 'اضافة فاتورة مبيعات', 'sellbillController.php', '96', '90', '3', '2026-10-09 14:51:51','0','0'); -- id=4073
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 778;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','01796', '331', '126', '1796', '3', '450', '1350', '0', '', '0', '2026-10-09 14:51:51', '1796', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','778-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=1171
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1171;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1796, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '3', storedetaildate = '2026-10-09 14:51:51' WHERE storedetailid = '2809';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1796', '1', '3', '1', '331', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '27', '3', '2026-10-09 14:51:51','0','0'); -- id=4074
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 552;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('423.2','01688', '331', '126', '1688', '3', '460', '1380', '0', '', '0', '2026-10-09 14:51:51', '1688', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','552-3,','1','1','0','0','460','1380','0','','0','0.00','0','0','0','0'); -- id=1172
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 423.20, meanbuyprice_withDiscount = 423.20
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 423.2
                where sellbilldetailid = 1172;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1688, '2026-10-09', 1380, 1380, 1380
                    , 1380, 1269.6, 1269.6, 1269.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1269.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1269.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1269.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1380, 1380, 1380
                    , 1380, 1269.6, 1269.6, 1269.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1269.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1269.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1269.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '3', storedetaildate = '2026-10-09 14:51:51' WHERE storedetailid = '2700';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1688', '1', '3', '1', '331', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '21', '3', '2026-10-09 14:51:51','0','0'); -- id=4075
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 205;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','01424', '331', '100', '1424', '6', '490', '2940', '0', '', '0', '2026-10-09 14:51:51', '1424', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','205-6,','1','1','0','0','490','2940','0','','0','0.00','0','0','0','0'); -- id=1173
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 457.50, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 457.50
        , lastbuyprice_withTax = 457.5, meanbuyprice_withTax = 457.5, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 1173;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1424, '2026-10-09', 2940, 2730, 2760
                    , 2745, 2760, 2745, 2760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2745, 2745, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2940, sellCostBuyPrice =sellCostBuyPrice+2730
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2745
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2745
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2745
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2745
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2940, 2730, 2760
                    , 2745, 2760, 2745, 2760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2745, 2745, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2940, sellCostBuyPrice =sellCostBuyPrice+2730
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2745
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2745
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2745
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2745
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '3', storedetaildate = '2026-10-09 14:51:51' WHERE storedetailid = '1437';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1424', '1', '6', '1', '331', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '15', '3', '2026-10-09 14:51:51','0','0'); -- id=4076
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 355;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('276','01467', '331', '104', '1467', '8', '340', '2720', '0', '', '0', '2026-10-09 14:51:51', '1467', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','355-8,','1','1','0','0','340','2720','0','','0','0.00','0','0','0','0'); -- id=1174
UPDATE sellbilldetail SET  lastbuyprice = 276.00 , meanbuyprice = 276.00, lastbuyprice_withDiscount = 276.00, meanbuyprice_withDiscount = 276.00
        , lastbuyprice_withTax = 276, meanbuyprice_withTax = 276, lastbuyprice_withDiscountAndTax = 276
                where sellbilldetailid = 1174;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1467, '2026-10-09', 2720, 2208, 2208
                    , 2208, 2208, 2208, 2208
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2208, 2208, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2720, sellCostBuyPrice =sellCostBuyPrice+2208
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2208, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2208
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2208, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2208
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2208
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2208
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2208
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2720, 2208, 2208
                    , 2208, 2208, 2208, 2208
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2208, 2208, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2720, sellCostBuyPrice =sellCostBuyPrice+2208
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2208, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2208
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2208, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2208
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2208
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2208
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2208
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '684', userid = '3', storedetaildate = '2026-10-09 14:51:51' WHERE storedetailid = '1492';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1467', '1', '8', '1', '331', 'اضافة فاتورة مبيعات', 'sellbillController.php', '692', '684', '3', '2026-10-09 14:51:51','0','0'); -- id=4077
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 551;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('377.2','01687', '331', '126', '1687', '6', '410', '2460', '0', '', '0', '2026-10-09 14:51:51', '1687', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','551-6,','1','1','0','0','410','2460','0','','0','0.00','0','0','0','0'); -- id=1175
UPDATE sellbilldetail SET  lastbuyprice = 410.00 , meanbuyprice = 410.00, lastbuyprice_withDiscount = 377.20, meanbuyprice_withDiscount = 377.20
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 410, lastbuyprice_withDiscountAndTax = 377.2
                where sellbilldetailid = 1175;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1687, '2026-10-09', 2460, 2460, 2460
                    , 2460, 2263.2, 2263.2, 2263.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2460, 2460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2460, sellCostBuyPrice =sellCostBuyPrice+2460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2263.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2263.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2263.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2460, 2460, 2460
                    , 2460, 2263.2, 2263.2, 2263.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2460, 2460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2460, sellCostBuyPrice =sellCostBuyPrice+2460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2263.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2263.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2263.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '42', userid = '3', storedetaildate = '2026-10-09 14:51:51' WHERE storedetailid = '2699';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1687', '1', '6', '1', '331', 'اضافة فاتورة مبيعات', 'sellbillController.php', '48', '42', '3', '2026-10-09 14:51:51','0','0'); -- id=4078
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 776;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('404.8','01794', '331', '126', '1794', '3', '440', '1320', '0', '', '0', '2026-10-09 14:51:51', '1794', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','776-3,','1','1','0','0','440','1320','0','','0','0.00','0','0','0','0'); -- id=1176
UPDATE sellbilldetail SET  lastbuyprice = 440.00 , meanbuyprice = 440.00, lastbuyprice_withDiscount = 404.80, meanbuyprice_withDiscount = 404.80
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 404.8
                where sellbilldetailid = 1176;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1794, '2026-10-09', 1320, 1320, 1320
                    , 1320, 1214.4, 1214.4, 1214.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1320, 1320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1214.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1214.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1214.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1320, 1320, 1320
                    , 1320, 1214.4, 1214.4, 1214.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1320, 1320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1214.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1214.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1214.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '3', storedetaildate = '2026-10-09 14:51:51' WHERE storedetailid = '2807';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1794', '1', '3', '1', '331', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '21', '3', '2026-10-09 14:51:51','0','0'); -- id=4079
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1907498',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1892028','15470', '0', '2', 'اضافة فاتورة مبيعات', '331', '1907498', '2026-10-09 14:51:51', '3',  'sellbillController.php','1','','0'); -- id=377
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '15470', '15470', '2026-10-09', '3', '0', '0', '2026-10-09 14:51:51','اضافة فاتورة مبيعات رقم 331','1','0',null,'0','331','sellbillController.php?do=showDetail&sellbillid=331'); -- id=1796
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1796', '419', '15470', '','0'); -- id=1827
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1907495', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1796', '143', '15470', '','0'); -- id=1796
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3437415', 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 ( '14026.2', '14026.2', '2026-10-09', '3', '0', '0', '2026-10-09 14:51:51','اضافة فاتورة مبيعات رقم 331 - صرف البضاعة من المخزن','1','0',null,'0','331','sellbillController.php?do=showDetail&sellbillid=331'); -- id=1797
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1797', '402', '14026.2', '','0'); -- id=1828
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3236344.55', 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 ('1797', '382', '14026.2', '','0'); -- id=1797
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20061290.65', 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='1796,0,1797' where sellbillid=331;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 15470, 14748, 14778
                    , 14763, 14026.2, 14011.2, 14026.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14763, 14763, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15470, sellCostBuyPrice =sellCostBuyPrice+14748
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14778, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14763
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14026.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14011.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14026.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14763
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14763
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 15470, 14748, 14778
                    , 14763, 14026.2, 14011.2, 14026.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14763, 14763, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15470, sellCostBuyPrice =sellCostBuyPrice+14748
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14778, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14763
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14026.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14011.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14026.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14763
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14763
                        , returnSellVal = returnSellVal+0, 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, 15470, 14748, 14778
                    , 14763, 14026.2, 14011.2, 14026.2, 14763, 14763)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+15470, netSellCostBuyPrice = netSellCostBuyPrice+14748
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+14778
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+14763
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+14026.2
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+14011.2
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+14026.2
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+14763
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+14763;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8d1ecf3fd1 and sellbillId = 331 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:21:54";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:51:54", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:51:54', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6000
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:22:13";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:52:13", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:52:13', '3', 'showDetail', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=331'); -- id=6001
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:22:50";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:52:50", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:52:50', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6002
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:22:51";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:52:51", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:52:51', '3', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6003
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:24:45";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:54:45", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:54:45', '6', 'addAndRetuen', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6004

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8d0b798534
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8d0b798534 and sellbillId = 332 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:24:47";
UPDATE user SET loginip = "102.46.204.191", lastactivetime = "2026-10-09 14:54:47", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:54:47', '6', 'addsellBill', '102.46.204.191', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6005
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:27:07";
UPDATE user SET loginip = "156.196.67.109", lastactivetime = "2026-10-09 14:57:07", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:57:07', '3', 'addAndRetuen', '156.196.67.109', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6006

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8d5935a147
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8d5935a147 and sellbillId = 333 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:27:08";
UPDATE user SET loginip = "156.196.67.109", lastactivetime = "2026-10-09 14:57:08", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:57:08', '3', 'addsellBill', '156.196.67.109', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6007
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:27:23";
UPDATE user SET loginip = "156.196.67.109", lastactivetime = "2026-10-09 14:57:23", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:57:23', '2', 'addsellBill', '156.196.67.109', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6008
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:27:28";
UPDATE user SET loginip = "156.196.67.109", lastactivetime = "2026-10-09 14:57:28", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:57:28', '2', 'addsellBill', '156.196.67.109', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6009
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:27:43";
UPDATE user SET loginip = "156.196.67.109", lastactivetime = "2026-10-09 14:57:43", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 14:57:43', '2', '', '156.196.67.109', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6010
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:27:44";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 14:57:44", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 14:57:44', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6011
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:27:47";
UPDATE user SET loginip = "156.196.67.109", lastactivetime = "2026-10-09 14:57:47", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:57:47', '2', 'addsellBill', '156.196.67.109', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6012
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:27:50";
UPDATE user SET loginip = "156.196.67.109", lastactivetime = "2026-10-09 14:57:50", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 14:57:50', '3', '', '156.196.67.109', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6013
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:28:12";
UPDATE user SET loginip = "156.196.67.109", lastactivetime = "2026-10-09 14:58:12", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:58:12', '3', 'showDetail', '156.196.67.109', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=333'); -- id=6014
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:28:46";
UPDATE user SET loginip = "156.196.67.109", lastactivetime = "2026-10-09 14:58:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storemovementController.php', '2026-10-09 14:58:46', '1', '', '156.196.67.109', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storemovementController.php'); -- id=6015
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:29:07";
UPDATE user SET loginip = "156.196.67.109", lastactivetime = "2026-10-09 14:59:07", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 14:59:07', '3', 'addsellBill', '156.196.67.109', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6016
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:29:57";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 14:59:57", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 14:59:57', '3', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6017
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:30:39";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:00:39", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 15:00:39', '2', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6018
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:30:39";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 15:00:39", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 15:00:39', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6019
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:30:39";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:00:39", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 15:00:39', '2', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6020
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:30:40";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 15:00:40", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 15:00:40', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6021
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:30:42";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:00:42", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:00:42', '2', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6022
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:30:42";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:30:45";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:00:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 15:00:45', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6023
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:30:46";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 15:00:46', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6024
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:30:54";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:00:54", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 15:00:54', '3', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6025
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:31:23";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:01:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-09 15:01:23', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=6026
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:31:30";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:01:30", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 15:01:30', '3', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6027
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:31:30";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 15:01:30', '3', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6028
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:32:09";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:02:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-09 15:02:09', '1', 'add2', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=add2'); -- id=6029
INSERT INTO productcat (productCatName, productCatDate, productCatDescription, productCatParent, userId, conditions, selldiscount, buydiscount, discounttype,isOptic , buytotal , buyhalf , buypart ,buypricereal,opticServices,logo,inMenu,stopNegativeSale,catExcelid,webApiId,obygyInvestigationCatId,price4,price5,price6,price7,price8,price9,price10,price11,price12,price13) VALUES ('اون لاين','2026-10-09','','93', '1','0', '0', '0', '-1', '0', '0', '0', '0','0','','.','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'); -- id=139
INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES (139, 1,'2026-10-09 15:02:09',1)
                ON DUPLICATE KEY UPDATE catid = 139, edited = 1, sysdate = '2026-10-09 15:02:09', userid = 1; -- id=151
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:32:10";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:02:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-09 15:02:10', '1', 'sucess', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=sucess'); -- id=6030
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:32:12";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:02:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-09 15:02:12', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=show'); -- id=6031
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:32:16";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:02:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-09 15:02:16', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=6032
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:32:18";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:02:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:02:18', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=6033
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:32:22";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:02:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:02:22', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=6034
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:32:24";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:02:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storemovementController.php', '2026-10-09 15:02:24', '1', 'add', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storemovementController.php?do=add'); -- id=6035
BEGIN;
CALL insertUniqueOptNum(6,1,2,1779,70,'2026-10-09',1,0, '' , '' ,0,0,0,0,0,'2026-10-09 15:02:24',0,'',0,'','hide',0,@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2792';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09', 1, 1779, 0, 0
                    , 252.00, 70, 0, 0, 1, '2026-10-09 15:02:24')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-70, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 15:02:24' ; -- id=737
UPDATE storemovement SET  buyPricesHistoryBookData = "70*2026-10-09*252.00," WHERE transferproductid = 23;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1779', '1', '70', '1', '23', 'تحويل منتجات من المخزن', 'storemovementController.php', '70', '0', '1', '2026-10-09','0','0'); -- id=4082
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1779', '2', '70', '1', '2026-10-09'); -- id=2810
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09', 2, 1779, 0, 0
                    , 252.00, 70, 0, 0, 1, '2026-10-09 15:02:24')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+70, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 15:02:24' ; -- id=780
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1779', '2', '70', '0', '23', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '70', '1', '2026-10-09','0','0'); -- id=4083
UPDATE storedetail SET inUse = 0 WHERE storedetailid=2792;
COMMIT;
BEGIN;
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '17640', '17640', '2026-10-09', '1', '0', '0', '2026-10-09 15:02:24','تحويل من مخزن المخزن الرئيسي الى مخزن مخزن المحل','1','0',null,'0','6','storemovementController.php?do=show&operationnum=6'); -- id=1802
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1802', '492', '17640', '','0'); -- id=1833
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '742625', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1802', '382', '17640', '','0'); -- id=1802
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20037650.65', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
COMMIT;
COMMIT;
UPDATE storemovement SET  dailyentryid =1802 WHERE operationnum = 6;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:32:25";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:02:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storemovementController.php', '2026-10-09 15:02:25', '1', 'sucess', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storemovementController.php?do=sucess'); -- id=6036
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:32:40";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:02:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storemovementController.php', '2026-10-09 15:02:40', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storemovementController.php?do=show'); -- id=6037
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:32:59";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:02:59", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 15:02:59', '3', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6038
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:32:59";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 15:02:59', '3', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6039
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:33:03";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:03:03", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:03:03', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6040
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:33:18";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:03:18", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:03:18', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6041
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:33:51";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:03:51", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:03:51', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6042
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:33:55";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:03:55", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:03:55', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6043
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:33:57";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:03:57", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:03:57', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6044
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:33:59";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:03:59", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:03:59', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6045
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:34:09";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:04:09", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:04:09', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6046
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:34:10";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:04:10", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 15:04:10', '4', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6047
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:34:54";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:04:54", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:04:54', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6048
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:34:56";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:04:56", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:04:56', '2', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6049

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8d76a739d8
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 15:04:56', '06ac8d76a739d8', '1', '0.00', '0', '0', '1', '22890.00', '22890', '22890', '0', '1', '2026-10-09 15:04:56', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '60' ,'0','','','','','-1','0','0','0','0','0','22890','0','','0','0','22890','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=334
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','334', '0', '2026-10-09 15:04:56', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '22890', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 15:04:56','0','0','',''); -- id=442
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 552;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('423.2','01688', '334', '126', '1688', '9', '460', '4140', '0', '', '0', '2026-10-09 15:04:56', '1688', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','552-9,','1','1','0','0','460','4140','0','','0','0.00','0','0','0','0'); -- id=1179
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 423.20, meanbuyprice_withDiscount = 423.20
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 423.2
                where sellbilldetailid = 1179;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1688, '2026-10-09', 4140, 4140, 4140
                    , 4140, 3808.8, 3808.8, 3808.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4140, 4140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4140, sellCostBuyPrice =sellCostBuyPrice+4140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3808.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3808.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3808.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4140
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4140, 4140, 4140
                    , 4140, 3808.8, 3808.8, 3808.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4140, 4140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4140, sellCostBuyPrice =sellCostBuyPrice+4140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3808.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3808.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3808.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4140
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '2', storedetaildate = '2026-10-09 15:04:56' WHERE storedetailid = '2700';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1688', '1', '9', '1', '334', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '12', '2', '2026-10-09 15:04:56','0','0'); -- id=4084
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 505;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('362.7','01659', '334', '125', '1659', '9', '390', '3510', '0', '', '0', '2026-10-09 15:04:56', '1659', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','505-9,','1','1','0','0','390','3510','0','','0','0.00','0','0','0','0'); -- id=1180
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 362.70, meanbuyprice_withDiscount = 362.70
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 362.7
                where sellbilldetailid = 1180;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1659, '2026-10-09', 3510, 3510, 3510
                    , 3510, 3264.3, 3264.3, 3264.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3510, 3510, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3510, sellCostBuyPrice =sellCostBuyPrice+3510
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3510, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3510
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3264.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3264.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3264.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3510
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3510
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3510, 3510, 3510
                    , 3510, 3264.3, 3264.3, 3264.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3510, 3510, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3510, sellCostBuyPrice =sellCostBuyPrice+3510
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3510, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3510
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3264.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3264.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3264.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3510
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3510
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '192', userid = '2', storedetaildate = '2026-10-09 15:04:56' WHERE storedetailid = '2671';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1659', '1', '9', '1', '334', 'اضافة فاتورة مبيعات', 'sellbillController.php', '201', '192', '2', '2026-10-09 15:04:56','0','0'); -- id=4085
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','01379', '334', '94', '1379', '6', '300', '1800', '0', '', '0', '2026-10-09 15:04:56', '1379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','71-6,','1','1','0','0','300','1800','0','','0','0.00','0','0','0','0'); -- id=1181
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1181;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-09', 1800, 1620, 1620
                    , 1620, 1620, 1620, 1620
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1620, 1620, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1800, sellCostBuyPrice =sellCostBuyPrice+1620
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1620, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1620
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1620, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1620
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1620
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1620
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1620
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1800, 1620, 1620
                    , 1620, 1620, 1620, 1620
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1620, 1620, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1800, sellCostBuyPrice =sellCostBuyPrice+1620
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1620, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1620
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1620, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1620
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1620
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1620
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1620
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '627', userid = '2', storedetaildate = '2026-10-09 15:04:56' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '6', '1', '334', 'اضافة فاتورة مبيعات', 'sellbillController.php', '633', '627', '2', '2026-10-09 15:04:56','0','0'); -- id=4086
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 235;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01456', '334', '94', '1456', '3', '360', '1080', '0', '', '0', '2026-10-09 15:04:56', '1456', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','235-3,','1','1','0','0','360','1080','0','','0','0.00','0','0','0','0'); -- id=1182
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 1182;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1456, '2026-10-09', 1080, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1080, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '168', userid = '2', storedetaildate = '2026-10-09 15:04:56' WHERE storedetailid = '1481';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1456', '1', '3', '1', '334', 'اضافة فاتورة مبيعات', 'sellbillController.php', '171', '168', '2', '2026-10-09 15:04:56','0','0'); -- id=4087
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 501;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('344.1','01656', '334', '125', '1656', '9', '370', '3330', '0', '', '0', '2026-10-09 15:04:56', '1656', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','501-9,','1','1','0','0','370','3330','0','','0','0.00','0','0','0','0'); -- id=1183
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 344.10, meanbuyprice_withDiscount = 344.10
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 344.1
                where sellbilldetailid = 1183;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1656, '2026-10-09', 3330, 3330, 3330
                    , 3330, 3096.9, 3096.9, 3096.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3330, 3330, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3330, sellCostBuyPrice =sellCostBuyPrice+3330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3096.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3096.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3096.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3330
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3330
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3330, 3330, 3330
                    , 3330, 3096.9, 3096.9, 3096.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3330, 3330, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3330, sellCostBuyPrice =sellCostBuyPrice+3330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3096.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3096.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3096.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3330
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3330
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 15:04:56' WHERE storedetailid = '2668';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1656', '1', '9', '1', '334', 'اضافة فاتورة مبيعات', 'sellbillController.php', '90', '81', '2', '2026-10-09 15:04:56','0','0'); -- id=4088
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 505;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('362.7','01659', '334', '125', '1659', '9', '390', '3510', '0', '', '0', '2026-10-09 15:04:56', '1659', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','505-9,','1','1','0','0','390','3510','0','','0','0.00','0','0','0','0'); -- id=1184
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 362.70, meanbuyprice_withDiscount = 362.70
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 362.7
                where sellbilldetailid = 1184;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1659, '2026-10-09', 3510, 3510, 3510
                    , 3510, 3264.3, 3264.3, 3264.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3510, 3510, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3510, sellCostBuyPrice =sellCostBuyPrice+3510
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3510, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3510
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3264.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3264.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3264.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3510
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3510
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3510, 3510, 3510
                    , 3510, 3264.3, 3264.3, 3264.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3510, 3510, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3510, sellCostBuyPrice =sellCostBuyPrice+3510
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3510, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3510
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3264.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3264.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3264.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3510
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3510
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '183', userid = '2', storedetaildate = '2026-10-09 15:04:56' WHERE storedetailid = '2671';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1659', '1', '9', '1', '334', 'اضافة فاتورة مبيعات', 'sellbillController.php', '192', '183', '2', '2026-10-09 15:04:56','0','0'); -- id=4089
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 235;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01456', '334', '94', '1456', '3', '360', '1080', '0', '', '0', '2026-10-09 15:04:56', '1456', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','235-3,','1','1','0','0','360','1080','0','','0','0.00','0','0','0','0'); -- id=1185
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 1185;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1456, '2026-10-09', 1080, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1080, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '165', userid = '2', storedetaildate = '2026-10-09 15:04:56' WHERE storedetailid = '1481';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1456', '1', '3', '1', '334', 'اضافة فاتورة مبيعات', 'sellbillController.php', '168', '165', '2', '2026-10-09 15:04:56','0','0'); -- id=4090
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 501;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('344.1','01656', '334', '125', '1656', '12', '370', '4440', '0', '', '0', '2026-10-09 15:04:56', '1656', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','501-12,','1','1','0','0','370','4440','0','','0','0.00','0','0','0','0'); -- id=1186
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 344.10, meanbuyprice_withDiscount = 344.10
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 344.1
                where sellbilldetailid = 1186;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1656, '2026-10-09', 4440, 4440, 4440
                    , 4440, 4129.2, 4129.2, 4129.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4440, 4440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4440, sellCostBuyPrice =sellCostBuyPrice+4440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4129.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4129.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4129.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4440, 4440, 4440
                    , 4440, 4129.2, 4129.2, 4129.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4440, 4440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4440, sellCostBuyPrice =sellCostBuyPrice+4440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4129.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4129.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4129.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '69', userid = '2', storedetaildate = '2026-10-09 15:04:56' WHERE storedetailid = '2668';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1656', '1', '12', '1', '334', 'اضافة فاتورة مبيعات', 'sellbillController.php', '81', '69', '2', '2026-10-09 15:04:56','0','0'); -- id=4091
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1934708',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1911818','22890', '0', '2', 'اضافة فاتورة مبيعات', '334', '1934708', '2026-10-09 15:04:56', '2',  'sellbillController.php','1','','0'); -- id=380
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '22890', '22890', '2026-10-09', '2', '0', '0', '2026-10-09 15:04:56','اضافة فاتورة مبيعات رقم 334','1','0',null,'0','334','sellbillController.php?do=showDetail&sellbillid=334'); -- id=1803
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1803', '419', '22890', '','0'); -- id=1834
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1934705', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1803', '143', '22890', '','0'); -- id=1803
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3466875', 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 ( '21103.5', '21103.5', '2026-10-09', '2', '0', '0', '2026-10-09 15:04:56','اضافة فاتورة مبيعات رقم 334 - صرف البضاعة من المخزن','1','0',null,'0','334','sellbillController.php?do=showDetail&sellbillid=334'); -- id=1804
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1804', '402', '21103.5', '','0'); -- id=1835
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3263448.05', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1804', '382', '21103.5', '','0'); -- id=1804
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20016547.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='1803,0,1804' where sellbillid=334;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 22890, 22470, 22470
                    , 22470, 21103.5, 21103.5, 21103.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,22470, 22470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22890, sellCostBuyPrice =sellCostBuyPrice+22470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22470, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+21103.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+21103.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+21103.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22470
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 22890, 22470, 22470
                    , 22470, 21103.5, 21103.5, 21103.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,22470, 22470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22890, sellCostBuyPrice =sellCostBuyPrice+22470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22470, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+21103.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+21103.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+21103.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22470
                        , returnSellVal = returnSellVal+0, 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, 22890, 22470, 22470
                    , 22470, 21103.5, 21103.5, 21103.5, 22470, 22470)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+22890, netSellCostBuyPrice = netSellCostBuyPrice+22470
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+22470
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+22470
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+21103.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+21103.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+21103.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+22470
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+22470;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8d76a739d8 and sellbillId = 334 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:34:56";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:04:56", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:04:56', '2', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6050
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:34:58";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:04:58", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:04:58', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6051
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:35:02";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:05:02", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:05:02', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6052
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:35:02";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:05:02", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:05:02', '4', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6053
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 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 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 blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:35:25";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:05:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:05:25', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=6054
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:35:31";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:05:31", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 15:05:31', '3', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6055
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:35:31";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 15:05:31', '3', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6056
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:35:34";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:05:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:05:34', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=6057
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:35:41";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:05:41", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:05:41', '4', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6058

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8d86e45e8a
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 15:05:41', '06ac8d86e45e8a', '1', '0.00', '0', '0', '1', '7000.00', '7000', '7000', '0', '2', '2026-10-09 15:05:41', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '25' ,'0','','','','','-1','0','0','0','0','0','7000','0','','0','0','7000','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=335
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','335', '0', '2026-10-09 15:05:41', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '7000', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 15:05:41','0','0','',''); -- id=443
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+25 where id = 780;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('252','01779', '335', '99', '1779', '25', '280', '7000', '0', '', '0', '2026-10-09 15:05:41', '1779', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','780-25,','1','1','0','0','280','7000','0','','0','0.00','0','0','0','0'); -- id=1187
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 280.00, lastbuyprice_withDiscount = 252.00, meanbuyprice_withDiscount = 252.00
        , lastbuyprice_withTax = 280, meanbuyprice_withTax = 280, lastbuyprice_withDiscountAndTax = 252
                where sellbilldetailid = 1187;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1779, '2026-10-09', 7000, 7000, 7000
                    , 7000, 6300, 6300, 6300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 7000, 7000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7000, sellCostBuyPrice =sellCostBuyPrice+7000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-09', 7000, 7000, 7000
                    , 7000, 6300, 6300, 6300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7000, 7000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7000, sellCostBuyPrice =sellCostBuyPrice+7000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '45', userid = '4', storedetaildate = '2026-10-09 15:05:41' WHERE storedetailid = '2810';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1779', '2', '25', '1', '335', 'اضافة فاتورة مبيعات', 'sellbillController.php', '70', '45', '4', '2026-10-09 15:05:41','0','0'); -- id=4092
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '455170',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('448170','7000', '0', '3', 'اضافة فاتورة مبيعات', '335', '455170', '2026-10-09 15:05:41', '4',  'sellbillController.php','1','','0'); -- id=381
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7000', '7000', '2026-10-09', '4', '0', '0', '2026-10-09 15:05:41','اضافة فاتورة مبيعات رقم 335','1','0',null,'0','335','sellbillController.php?do=showDetail&sellbillid=335'); -- id=1805
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1805', '501', '7000', '','0'); -- id=1836
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '455170', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1805', '143', '7000', '','0'); -- id=1805
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3473875', 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 ( '6300', '6300', '2026-10-09', '4', '0', '0', '2026-10-09 15:05:41','اضافة فاتورة مبيعات رقم 335 - صرف البضاعة من المخزن','1','0',null,'0','335','sellbillController.php?do=showDetail&sellbillid=335'); -- id=1806
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1806', '402', '6300', '','0'); -- id=1837
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3269748.05', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1806', '492', '6300', '','0'); -- id=1806
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '736325', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1805,0,1806' where sellbillid=335;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 7000, 7000, 7000
                    , 7000, 6300, 6300, 6300
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7000, 7000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7000, sellCostBuyPrice =sellCostBuyPrice+7000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 7000, 7000, 7000
                    , 7000, 6300, 6300, 6300
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7000, 7000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7000, sellCostBuyPrice =sellCostBuyPrice+7000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7000
                        , returnSellVal = returnSellVal+0, 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, 7000, 7000, 7000
                    , 7000, 6300, 6300, 6300, 7000, 7000)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+7000, netSellCostBuyPrice = netSellCostBuyPrice+7000
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+7000
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+7000
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+6300
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+6300
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+6300
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+7000
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+7000;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:35:41";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:05:41", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:05:41', '4', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6059
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:36:05";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:06:05", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:06:05', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6060
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:36:16";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:06:16", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:06:16', '4', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6061

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8d895dc7d2
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 15:06:16', '06ac8d895dc7d2', '1', '0.00', '0', '0', '1', '2800.00', '2800', '2800', '0', '2', '2026-10-09 15:06:16', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '10' ,'0','','','','','-1','0','0','0','0','0','2800','0','','0','0','2800','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=336
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','336', '0', '2026-10-09 15:06:16', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2800', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 15:06:16','0','0','',''); -- id=444
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 780;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('252','01779', '336', '99', '1779', '10', '280', '2800', '0', '', '0', '2026-10-09 15:06:16', '1779', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','780-10,','1','1','0','0','280','2800','0','','0','0.00','0','0','0','0'); -- id=1188
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 280.00, lastbuyprice_withDiscount = 252.00, meanbuyprice_withDiscount = 252.00
        , lastbuyprice_withTax = 280, meanbuyprice_withTax = 280, lastbuyprice_withDiscountAndTax = 252
                where sellbilldetailid = 1188;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1779, '2026-10-09', 2800, 2800, 2800
                    , 2800, 2520, 2520, 2520
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2800, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 2800, 2800, 2800
                    , 2800, 2520, 2520, 2520
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2800, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '35', userid = '4', storedetaildate = '2026-10-09 15:06:16' WHERE storedetailid = '2810';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1779', '2', '10', '1', '336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '45', '35', '4', '2026-10-09 15:06:16','0','0'); -- id=4093
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '457970',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('455170','2800', '0', '3', 'اضافة فاتورة مبيعات', '336', '457970', '2026-10-09 15:06:16', '4',  'sellbillController.php','1','','0'); -- id=382
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2800', '2800', '2026-10-09', '4', '0', '0', '2026-10-09 15:06:16','اضافة فاتورة مبيعات رقم 336','1','0',null,'0','336','sellbillController.php?do=showDetail&sellbillid=336'); -- id=1807
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1807', '501', '2800', '','0'); -- id=1838
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '457970', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1807', '143', '2800', '','0'); -- id=1807
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3476675', 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 ( '2520', '2520', '2026-10-09', '4', '0', '0', '2026-10-09 15:06:16','اضافة فاتورة مبيعات رقم 336 - صرف البضاعة من المخزن','1','0',null,'0','336','sellbillController.php?do=showDetail&sellbillid=336'); -- id=1808
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1808', '402', '2520', '','0'); -- id=1839
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3272268.05', 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 ('1808', '492', '2520', '','0'); -- id=1808
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '733805', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1807,0,1808' where sellbillid=336;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 2800, 2800, 2800
                    , 2800, 2520, 2520, 2520
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2800, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2800, 2800, 2800
                    , 2800, 2520, 2520, 2520
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2800, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, 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, 2800, 2800, 2800
                    , 2800, 2520, 2520, 2520, 2800, 2800)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2800, netSellCostBuyPrice = netSellCostBuyPrice+2800
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2800
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2800
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2520
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2520
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2520
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2800
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2800;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8d895dc7d2 and sellbillId = 336 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:36:16";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:06:16", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:06:16', '4', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6062
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:36:31";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:06:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:06:31', '1', 'add', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=6063
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 ('موديل 1035 اون لاين','','139','310','310','310','310','2026-10-09','0','1','0','','0','0','0','0','0','310','310','310','310','310','0','0','0','0','.','0','0','0','310','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','310','310','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','310','0','0','0','0','0','0','','','0','0','0','0'); -- id=1797
UPDATE product SET productName = 'موديل 1035 اون لاين', productDescription = '', productCatId = '139', productBuyPrice = '310', productSellAllPrice = '310', productSellUnitPrice = '310', productSellHalfPrice = '310', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01797',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '310',lastbuyprice_withDiscount = '310',meanbuyprice = '310',meanbuyprice_withDiscount = '310' , productbuypricereal = '310' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',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='310',meanbuyprice_withTax='310',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='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1797';
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', '1797', '1', '2026-10-09', '1', '0','0179701','310','310','310','310','','0','0','0','0','0','0','0','0','0','0'); -- id=1797
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1797', '1', '0', '1', '2026-10-09'); -- id=2811
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1797', '1', '0', '0', '1797', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4094
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1797, 1,'2026-10-09 15:06:31',1)
                ON DUPLICATE KEY UPDATE productid = 1797, edited = 1, sysdate = '2026-10-09 15:06:31', userid = 1; -- id=2716
UPDATE product SET productName = 'موديل 1035 اون لاين', productDescription = '', productCatId = '139', productBuyPrice = '310.00', productSellAllPrice = '310.00', productSellUnitPrice = '310.00', productSellHalfPrice = '310.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01797',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '310',lastbuyprice_withDiscount = '310',meanbuyprice = '310',meanbuyprice_withDiscount = '310' , productbuypricereal = '310' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',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='310',meanbuyprice_withTax='310',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='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1797';
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 ('موديل 2010 اون لاين ','','139','310','310','310','310','2026-10-09','0','1','0','','0','0','0','0','0','310','310','310','310','310','0','0','0','0','.','0','0','0','310','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','310','310','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','310','0','0','0','0','0','0','','','0','0','0','0'); -- id=1798
UPDATE product SET productName = 'موديل 2010 اون لاين ', productDescription = '', productCatId = '139', productBuyPrice = '310', productSellAllPrice = '310', productSellUnitPrice = '310', productSellHalfPrice = '310', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01798',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '310',lastbuyprice_withDiscount = '310',meanbuyprice = '310',meanbuyprice_withDiscount = '310' , productbuypricereal = '310' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',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='310',meanbuyprice_withTax='310',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='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1798';
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', '1798', '1', '2026-10-09', '1', '0','0179801','310','310','310','310','','0','0','0','0','0','0','0','0','0','0'); -- id=1798
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1798', '1', '0', '1', '2026-10-09'); -- id=2812
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1798', '1', '0', '0', '1798', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4095
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1798, 1,'2026-10-09 15:06:31',1)
                ON DUPLICATE KEY UPDATE productid = 1798, edited = 1, sysdate = '2026-10-09 15:06:31', userid = 1; -- id=2717
UPDATE product SET productName = 'موديل 2010 اون لاين ', productDescription = '', productCatId = '139', productBuyPrice = '310.00', productSellAllPrice = '310.00', productSellUnitPrice = '310.00', productSellHalfPrice = '310.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01798',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '310',lastbuyprice_withDiscount = '310',meanbuyprice = '310',meanbuyprice_withDiscount = '310' , productbuypricereal = '310' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',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='310',meanbuyprice_withTax='310',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='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1798';
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 ('موديل 1030 اون لاين','','139','260','260','260','260','2026-10-09','0','1','0','','0','0','0','0','0','260','260','260','260','260','0','0','0','0','.','0','0','0','260','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','260','260','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','260','0','0','0','0','0','0','','','0','0','0','0'); -- id=1799
UPDATE product SET productName = 'موديل 1030 اون لاين', productDescription = '', productCatId = '139', productBuyPrice = '260', productSellAllPrice = '260', productSellUnitPrice = '260', productSellHalfPrice = '260', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01799',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '260',lastbuyprice_withDiscount = '260',meanbuyprice = '260',meanbuyprice_withDiscount = '260' , productbuypricereal = '260' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='260',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='260',meanbuyprice_withTax='260',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='260',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1799';
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', '1799', '1', '2026-10-09', '1', '0','0179901','260','260','260','260','','0','0','0','0','0','0','0','0','0','0'); -- id=1799
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1799', '1', '0', '1', '2026-10-09'); -- id=2813
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1799', '1', '0', '0', '1799', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4096
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1799, 1,'2026-10-09 15:06:31',1)
                ON DUPLICATE KEY UPDATE productid = 1799, edited = 1, sysdate = '2026-10-09 15:06:31', userid = 1; -- id=2718
UPDATE product SET productName = 'موديل 1030 اون لاين', productDescription = '', productCatId = '139', productBuyPrice = '260.00', productSellAllPrice = '260.00', productSellUnitPrice = '260.00', productSellHalfPrice = '260.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01799',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '260',lastbuyprice_withDiscount = '260',meanbuyprice = '260',meanbuyprice_withDiscount = '260' , productbuypricereal = '260' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='260',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='260',meanbuyprice_withTax='260',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='260',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1799';
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 ('موديل 1040 اون لاين ','','139','320','320','320','320','2026-10-09','0','1','0','','0','0','0','0','0','320','320','320','320','320','0','0','0','0','.','0','0','0','320','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','320','320','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','320','0','0','0','0','0','0','','','0','0','0','0'); -- id=1800
UPDATE product SET productName = 'موديل 1040 اون لاين ', productDescription = '', productCatId = '139', productBuyPrice = '320', productSellAllPrice = '320', productSellUnitPrice = '320', productSellHalfPrice = '320', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01800',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '320',lastbuyprice_withDiscount = '320',meanbuyprice = '320',meanbuyprice_withDiscount = '320' , productbuypricereal = '320' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='320',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='320',meanbuyprice_withTax='320',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='320',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1800';
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', '1800', '1', '2026-10-09', '1', '0','0180001','320','320','320','320','','0','0','0','0','0','0','0','0','0','0'); -- id=1800
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1800', '1', '0', '1', '2026-10-09'); -- id=2814
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1800', '1', '0', '0', '1800', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4097
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1800, 1,'2026-10-09 15:06:31',1)
                ON DUPLICATE KEY UPDATE productid = 1800, edited = 1, sysdate = '2026-10-09 15:06:31', userid = 1; -- id=2719
UPDATE product SET productName = 'موديل 1040 اون لاين ', productDescription = '', productCatId = '139', productBuyPrice = '320.00', productSellAllPrice = '320.00', productSellUnitPrice = '320.00', productSellHalfPrice = '320.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01800',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '320',lastbuyprice_withDiscount = '320',meanbuyprice = '320',meanbuyprice_withDiscount = '320' , productbuypricereal = '320' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='320',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='320',meanbuyprice_withTax='320',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='320',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1800';
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 ('موديل 1025 اون لاين ','','139','300','300','300','300','2026-10-09','0','1','0','','0','0','0','0','0','300','300','300','300','300','0','0','0','0','.','0','0','0','300','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','300','300','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','300','0','0','0','0','0','0','','','0','0','0','0'); -- id=1801
UPDATE product SET productName = 'موديل 1025 اون لاين ', productDescription = '', productCatId = '139', productBuyPrice = '300', productSellAllPrice = '300', productSellUnitPrice = '300', productSellHalfPrice = '300', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01801',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '300',lastbuyprice_withDiscount = '300',meanbuyprice = '300',meanbuyprice_withDiscount = '300' , productbuypricereal = '300' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='300',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='300',meanbuyprice_withTax='300',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='300',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1801';
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', '1801', '1', '2026-10-09', '1', '0','0180101','300','300','300','300','','0','0','0','0','0','0','0','0','0','0'); -- id=1801
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1801', '1', '0', '1', '2026-10-09'); -- id=2815
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1801', '1', '0', '0', '1801', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4098
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1801, 1,'2026-10-09 15:06:31',1)
                ON DUPLICATE KEY UPDATE productid = 1801, edited = 1, sysdate = '2026-10-09 15:06:31', userid = 1; -- id=2720
UPDATE product SET productName = 'موديل 1025 اون لاين ', productDescription = '', productCatId = '139', productBuyPrice = '300.00', productSellAllPrice = '300.00', productSellUnitPrice = '300.00', productSellHalfPrice = '300.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01801',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '300',lastbuyprice_withDiscount = '300',meanbuyprice = '300',meanbuyprice_withDiscount = '300' , productbuypricereal = '300' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='300',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='300',meanbuyprice_withTax='300',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='300',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1801';
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 ('موديل 1010 اون لاين','','139','360','360','360','360','2026-10-09','0','1','0','','0','0','0','0','0','360','360','360','360','360','0','0','0','0','.','0','0','0','360','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','360','360','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','360','0','0','0','0','0','0','','','0','0','0','0'); -- id=1802
UPDATE product SET productName = 'موديل 1010 اون لاين', productDescription = '', productCatId = '139', productBuyPrice = '360', productSellAllPrice = '360', productSellUnitPrice = '360', productSellHalfPrice = '360', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01802',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360',lastbuyprice_withDiscount = '360',meanbuyprice = '360',meanbuyprice_withDiscount = '360' , productbuypricereal = '360' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='360',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='360',meanbuyprice_withTax='360',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='360',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1802';
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', '1802', '1', '2026-10-09', '1', '0','0180201','360','360','360','360','','0','0','0','0','0','0','0','0','0','0'); -- id=1802
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1802', '1', '0', '1', '2026-10-09'); -- id=2816
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1802', '1', '0', '0', '1802', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4099
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1802, 1,'2026-10-09 15:06:31',1)
                ON DUPLICATE KEY UPDATE productid = 1802, edited = 1, sysdate = '2026-10-09 15:06:31', userid = 1; -- id=2721
UPDATE product SET productName = 'موديل 1010 اون لاين', productDescription = '', productCatId = '139', productBuyPrice = '360.00', productSellAllPrice = '360.00', productSellUnitPrice = '360.00', productSellHalfPrice = '360.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01802',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360',lastbuyprice_withDiscount = '360',meanbuyprice = '360',meanbuyprice_withDiscount = '360' , productbuypricereal = '360' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='360',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='360',meanbuyprice_withTax='360',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='360',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1802';
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 ('موديل 1015اون لاين ','','139','310','310','310','310','2026-10-09','0','1','0','','0','0','0','0','0','310','310','310','310','310','0','0','0','0','.','0','0','0','310','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','310','310','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','310','0','0','0','0','0','0','','','0','0','0','0'); -- id=1803
UPDATE product SET productName = 'موديل 1015اون لاين ', productDescription = '', productCatId = '139', productBuyPrice = '310', productSellAllPrice = '310', productSellUnitPrice = '310', productSellHalfPrice = '310', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01803',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '310',lastbuyprice_withDiscount = '310',meanbuyprice = '310',meanbuyprice_withDiscount = '310' , productbuypricereal = '310' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',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='310',meanbuyprice_withTax='310',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='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1803';
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', '1803', '1', '2026-10-09', '1', '0','0180301','310','310','310','310','','0','0','0','0','0','0','0','0','0','0'); -- id=1803
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1803', '1', '0', '1', '2026-10-09'); -- id=2817
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1803', '1', '0', '0', '1803', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4100
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1803, 1,'2026-10-09 15:06:31',1)
                ON DUPLICATE KEY UPDATE productid = 1803, edited = 1, sysdate = '2026-10-09 15:06:31', userid = 1; -- id=2722
UPDATE product SET productName = 'موديل 1015اون لاين ', productDescription = '', productCatId = '139', productBuyPrice = '310.00', productSellAllPrice = '310.00', productSellUnitPrice = '310.00', productSellHalfPrice = '310.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01803',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '310',lastbuyprice_withDiscount = '310',meanbuyprice = '310',meanbuyprice_withDiscount = '310' , productbuypricereal = '310' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',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='310',meanbuyprice_withTax='310',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='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1803';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:36:33";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:06:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:06:33', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=6064
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:36:35";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:06:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:06:35', '1', 'bill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6065
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('اون لاين', '', '', '', '', '0', '1', '2026-10-09 15:06:57', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=135
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 ('135', '0', '', '0', 'إضافة مورد جديد', '135', '', '2026-10-09 15:06:57', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=291
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('اون لاين', 'اون لاين', 'اون لاين', 'اون لاين', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 15:06:57'); -- id=618
UPDATE supplier SET suppliername = 'اون لاين', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='618',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '135';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:37:39";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:07:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:07:39', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=6066
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:37:54";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:07:54", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 15:07:54', '3', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6067
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:37:58";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:07:58", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:07:58', '3', 'showDetail', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=333'); -- id=6068
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:38:17";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:08:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:08:17', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=6069
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:38:26";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:08:26", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 15:08:26', '2', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6070
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:38:38";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:08:38", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:08:38', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6071
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:38:38";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:08:38", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:08:38', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6072
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:38:58";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:08:58", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:08:58', '2', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6073
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:39:09";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:09:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:09:09', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=6074
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:39:34";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:09:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:09:34', '1', 'bill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6075
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:39:35";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:09:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:09:35', '1', 'bill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6076
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:39:39";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:09:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:09:39', '1', 'bill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6077
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:40:31";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:10:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:10:31', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=6078
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:40:47";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:40:47";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:40:51";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:10:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 15:10:51', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6079
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:40:51";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 15:10:51', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6080
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:41:12";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:11:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:11:12', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=6081
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:41:12";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:11:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:11:12', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=6082
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:41:44";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:11:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:11:44', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=6083
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:42:59";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:12:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:12:59', '1', 'bill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6084
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:43:00";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:13:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:13:00', '1', 'bill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6085
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:44:19";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:14:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:14:19', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=6086
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:44:48";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:14:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:14:48', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=6087
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:45:20";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:15:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:15:20', '1', 'tempdelete', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=tempdelete&id=1798&optic=0'); -- id=6088
BEGIN;
UPDATE product SET conditions =1 WHERE productId =1798;
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1798, 2,'2026-10-09 15:15:20',1)
                ON DUPLICATE KEY UPDATE productid = 1798, edited = 2, sysdate = '2026-10-09 15:15:20', userid = 1; -- id=2717
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:45:21";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:15:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:15:21', '1', 'sucess', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=sucess'); -- id=6089
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:45:30";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:15:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:15:30', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=6090
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:46:03";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:16:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:16:03', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=6091
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:46:45";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:16:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:16:45', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=6092
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:46:46";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:16:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:16:46', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=6093
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:47:20";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:17:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:17:20', '1', 'add', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=6094
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 ('موديل 1020 اون لاين','','139','310','310','310','310','2026-10-09','0','1','0','','0','0','0','0','0','310','310','310','310','310','0','0','0','0','.','0','0','0','310','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','310','310','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','310','0','0','0','0','0','0','','','0','0','0','0'); -- id=1804
UPDATE product SET productName = 'موديل 1020 اون لاين', productDescription = '', productCatId = '139', productBuyPrice = '310', productSellAllPrice = '310', productSellUnitPrice = '310', productSellHalfPrice = '310', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01804',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '310',lastbuyprice_withDiscount = '310',meanbuyprice = '310',meanbuyprice_withDiscount = '310' , productbuypricereal = '310' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',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='310',meanbuyprice_withTax='310',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='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1804';
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', '1804', '1', '2026-10-09', '1', '0','0180401','310','310','310','310','','0','0','0','0','0','0','0','0','0','0'); -- id=1804
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1804', '1', '0', '1', '2026-10-09'); -- id=2818
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1804', '1', '0', '0', '1804', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4101
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1804, 1,'2026-10-09 15:17:20',1)
                ON DUPLICATE KEY UPDATE productid = 1804, edited = 1, sysdate = '2026-10-09 15:17:20', userid = 1; -- id=2724
UPDATE product SET productName = 'موديل 1020 اون لاين', productDescription = '', productCatId = '139', productBuyPrice = '310.00', productSellAllPrice = '310.00', productSellUnitPrice = '310.00', productSellHalfPrice = '310.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01804',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '310',lastbuyprice_withDiscount = '310',meanbuyprice = '310',meanbuyprice_withDiscount = '310' , productbuypricereal = '310' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',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='310',meanbuyprice_withTax='310',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='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1804';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:47:36";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:17:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:17:36', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=6095
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:47:52";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:17:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:17:52', '1', 'bill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6096
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:47:52";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:17:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:17:52', '1', 'bill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6097
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:50:17";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:20:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:20:17', '1', 'add', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=6098
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 ('06ac8db709f338', '2026-10-09 15:17:52', '135', '0.00', '67356', '10', '1', '74840.00',  '67356.00', '0', '67356', '1', '2026-10-09 15:20:17', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=95
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 ('01797', '95', '139', '1797', '36', '310', '11160.00', '0', '', '2026-10-09 15:20:17', '1797','','','0','0','0','0','0',null,'310','11160','0','0','0','0','0','0','0','0','1'); -- id=613
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 15:17:52', 1, 1797, 0, 0
                    , 279, 36, 0, 0, 1, '2026-10-09 15:20:17')
                ON DUPLICATE KEY UPDATE buyprice = 279,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 15:20:17' ; -- id=781
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1797', '310', '36', '0', 'buyBillController.php', '613', '', '0', '0'); -- id=488
UPDATE product SET  productBuyPrice = "310" WHERE productId = 1797 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 613 ;
UPDATE product SET productName = 'موديل 1035 اون لاين', productDescription = '', productCatId = '139', productBuyPrice = '310.00', productSellAllPrice = '310.00', productSellUnitPrice = '310.00', productSellHalfPrice = '310.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01797',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '310',lastbuyprice_withDiscount = '279',meanbuyprice = '310',meanbuyprice_withDiscount = '279' , productbuypricereal = '310.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',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='310',meanbuyprice_withTax='310',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='279',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1797';
UPDATE buybilldetail SET  lastbuyprice = 310 , meanbuyprice = 310, lastbuyprice_withDiscount = 279, meanbuyprice_withDiscount = 279
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 279
                where buybilldetailid = 613;
UPDATE productunit SET proUnitBuyPrice  = 310 * productnumber WHERE productid = 1797;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2811';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1797', '1', '36', '0', '95', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '1', '2026-10-09 15:17:52','0','0'); -- id=4102
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 ('01804', '95', '139', '1804', '32', '310', '9920.00', '0', '', '2026-10-09 15:20:17', '1804','','','0','0','0','0','0',null,'310','9920','0','0','0','0','0','0','0','0','1'); -- id=614
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 15:17:52', 1, 1804, 0, 0
                    , 279, 32, 0, 0, 1, '2026-10-09 15:20:17')
                ON DUPLICATE KEY UPDATE buyprice = 279,
                        buyQuantity =buyQuantity+32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 15:20:17' ; -- id=782
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1804', '310', '32', '0', 'buyBillController.php', '614', '', '0', '0'); -- id=489
UPDATE product SET  productBuyPrice = "310" WHERE productId = 1804 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 614 ;
UPDATE product SET productName = 'موديل 1020 اون لاين', productDescription = '', productCatId = '139', productBuyPrice = '310.00', productSellAllPrice = '310.00', productSellUnitPrice = '310.00', productSellHalfPrice = '310.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01804',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '310',lastbuyprice_withDiscount = '279',meanbuyprice = '310',meanbuyprice_withDiscount = '279' , productbuypricereal = '310.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',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='310',meanbuyprice_withTax='310',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='279',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1804';
UPDATE buybilldetail SET  lastbuyprice = 310 , meanbuyprice = 310, lastbuyprice_withDiscount = 279, meanbuyprice_withDiscount = 279
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 279
                where buybilldetailid = 614;
UPDATE productunit SET proUnitBuyPrice  = 310 * productnumber WHERE productid = 1804;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2818';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1804', '1', '32', '0', '95', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '32', '1', '2026-10-09 15:17:52','0','0'); -- id=4103
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 ('01799', '95', '139', '1799', '40', '260', '10400.00', '0', '', '2026-10-09 15:20:17', '1799','','','0','0','0','0','0',null,'260','10400','0','0','0','0','0','0','0','0','1'); -- id=615
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 15:17:52', 1, 1799, 0, 0
                    , 234, 40, 0, 0, 1, '2026-10-09 15:20:17')
                ON DUPLICATE KEY UPDATE buyprice = 234,
                        buyQuantity =buyQuantity+40, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 15:20:17' ; -- id=783
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1799', '260', '40', '0', 'buyBillController.php', '615', '', '0', '0'); -- id=490
UPDATE product SET  productBuyPrice = "260" WHERE productId = 1799 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 615 ;
UPDATE product SET productName = 'موديل 1030 اون لاين', productDescription = '', productCatId = '139', productBuyPrice = '260.00', productSellAllPrice = '260.00', productSellUnitPrice = '260.00', productSellHalfPrice = '260.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01799',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '260',lastbuyprice_withDiscount = '234',meanbuyprice = '260',meanbuyprice_withDiscount = '234' , productbuypricereal = '260.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='260',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='260',meanbuyprice_withTax='260',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='234',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1799';
UPDATE buybilldetail SET  lastbuyprice = 260 , meanbuyprice = 260, lastbuyprice_withDiscount = 234, meanbuyprice_withDiscount = 234
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260, lastbuyprice_withDiscountAndTax = 234
                where buybilldetailid = 615;
UPDATE productunit SET proUnitBuyPrice  = 260 * productnumber WHERE productid = 1799;
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2813';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1799', '1', '40', '0', '95', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '40', '1', '2026-10-09 15:17:52','0','0'); -- id=4104
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 ('01800', '95', '139', '1800', '40', '320', '12800.00', '0', '', '2026-10-09 15:20:17', '1800','','','0','0','0','0','0',null,'320','12800','0','0','0','0','0','0','0','0','1'); -- id=616
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 15:17:52', 1, 1800, 0, 0
                    , 288, 40, 0, 0, 1, '2026-10-09 15:20:17')
                ON DUPLICATE KEY UPDATE buyprice = 288,
                        buyQuantity =buyQuantity+40, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 15:20:17' ; -- id=784
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1800', '320', '40', '0', 'buyBillController.php', '616', '', '0', '0'); -- id=491
UPDATE product SET  productBuyPrice = "320" WHERE productId = 1800 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 616 ;
UPDATE product SET productName = 'موديل 1040 اون لاين ', productDescription = '', productCatId = '139', productBuyPrice = '320.00', productSellAllPrice = '320.00', productSellUnitPrice = '320.00', productSellHalfPrice = '320.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01800',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '320',lastbuyprice_withDiscount = '288',meanbuyprice = '320',meanbuyprice_withDiscount = '288' , productbuypricereal = '320.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='320',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='320',meanbuyprice_withTax='320',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='288',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1800';
UPDATE buybilldetail SET  lastbuyprice = 320 , meanbuyprice = 320, lastbuyprice_withDiscount = 288, meanbuyprice_withDiscount = 288
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 288
                where buybilldetailid = 616;
UPDATE productunit SET proUnitBuyPrice  = 320 * productnumber WHERE productid = 1800;
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2814';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1800', '1', '40', '0', '95', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '40', '1', '2026-10-09 15:17:52','0','0'); -- id=4105
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 ('01801', '95', '139', '1801', '40', '300', '12000.00', '0', '', '2026-10-09 15:20:17', '1801','','','0','0','0','0','0',null,'300','12000','0','0','0','0','0','0','0','0','1'); -- id=617
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 15:17:52', 1, 1801, 0, 0
                    , 270, 40, 0, 0, 1, '2026-10-09 15:20:17')
                ON DUPLICATE KEY UPDATE buyprice = 270,
                        buyQuantity =buyQuantity+40, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 15:20:17' ; -- id=785
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1801', '300', '40', '0', 'buyBillController.php', '617', '', '0', '0'); -- id=492
UPDATE product SET  productBuyPrice = "300" WHERE productId = 1801 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 617 ;
UPDATE product SET productName = 'موديل 1025 اون لاين ', productDescription = '', productCatId = '139', productBuyPrice = '300.00', productSellAllPrice = '300.00', productSellUnitPrice = '300.00', productSellHalfPrice = '300.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01801',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '300',lastbuyprice_withDiscount = '270',meanbuyprice = '300',meanbuyprice_withDiscount = '270' , productbuypricereal = '300.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='300',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='300',meanbuyprice_withTax='300',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='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 = '1801';
UPDATE buybilldetail SET  lastbuyprice = 300 , meanbuyprice = 300, lastbuyprice_withDiscount = 270, meanbuyprice_withDiscount = 270
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 270
                where buybilldetailid = 617;
UPDATE productunit SET proUnitBuyPrice  = 300 * productnumber WHERE productid = 1801;
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2815';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1801', '1', '40', '0', '95', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '40', '1', '2026-10-09 15:17:52','0','0'); -- id=4106
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 ('01802', '95', '139', '1802', '24', '360', '8640.00', '0', '', '2026-10-09 15:20:17', '1802','','','0','0','0','0','0',null,'360','8640','0','0','0','0','0','0','0','0','1'); -- id=618
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 15:17:52', 1, 1802, 0, 0
                    , 324, 24, 0, 0, 1, '2026-10-09 15:20:17')
                ON DUPLICATE KEY UPDATE buyprice = 324,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 15:20:17' ; -- id=786
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1802', '360', '24', '0', 'buyBillController.php', '618', '', '0', '0'); -- id=493
UPDATE product SET  productBuyPrice = "360" WHERE productId = 1802 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 618 ;
UPDATE product SET productName = 'موديل 1010 اون لاين', productDescription = '', productCatId = '139', productBuyPrice = '360.00', productSellAllPrice = '360.00', productSellUnitPrice = '360.00', productSellHalfPrice = '360.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01802',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360',lastbuyprice_withDiscount = '324',meanbuyprice = '360',meanbuyprice_withDiscount = '324' , productbuypricereal = '360.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='360',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='360',meanbuyprice_withTax='360',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='324',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1802';
UPDATE buybilldetail SET  lastbuyprice = 360 , meanbuyprice = 360, lastbuyprice_withDiscount = 324, meanbuyprice_withDiscount = 324
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 324
                where buybilldetailid = 618;
UPDATE productunit SET proUnitBuyPrice  = 360 * productnumber WHERE productid = 1802;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2816';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1802', '1', '24', '0', '95', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 15:17:52','0','0'); -- id=4107
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 ('01803', '95', '139', '1803', '32', '310', '9920.00', '0', '', '2026-10-09 15:20:17', '1803','','','0','0','0','0','0',null,'310','9920','0','0','0','0','0','0','0','0','1'); -- id=619
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 15:17:52', 1, 1803, 0, 0
                    , 279, 32, 0, 0, 1, '2026-10-09 15:20:17')
                ON DUPLICATE KEY UPDATE buyprice = 279,
                        buyQuantity =buyQuantity+32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 15:20:17' ; -- id=787
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1803', '310', '32', '0', 'buyBillController.php', '619', '', '0', '0'); -- id=494
UPDATE product SET  productBuyPrice = "310" WHERE productId = 1803 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 619 ;
UPDATE product SET productName = 'موديل 1015اون لاين ', productDescription = '', productCatId = '139', productBuyPrice = '310.00', productSellAllPrice = '310.00', productSellUnitPrice = '310.00', productSellHalfPrice = '310.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01803',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '310',lastbuyprice_withDiscount = '279',meanbuyprice = '310',meanbuyprice_withDiscount = '279' , productbuypricereal = '310.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',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='310',meanbuyprice_withTax='310',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='279',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1803';
UPDATE buybilldetail SET  lastbuyprice = 310 , meanbuyprice = 310, lastbuyprice_withDiscount = 279, meanbuyprice_withDiscount = 279
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 279
                where buybilldetailid = 619;
UPDATE productunit SET proUnitBuyPrice  = 310 * productnumber WHERE productid = 1803;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2817';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1803', '1', '32', '0', '95', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '32', '1', '2026-10-09 15:17:52','0','0'); -- id=4108
UPDATE supplier SET  suppliercurrentDebt = '67356',suppliercurrentDebtInCurrency= '67356' , userid = '1', supplierdate = '2026-10-09 15:20:17'   WHERE supplierid = '135';
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 ('135', '0.00', '67356', '0', 'اضافة فاتورة مشتريات', '95', '67356', '2026-10-09 15:17:52', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','67356','1','0','67356','67356','0',''); -- id=292
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '67356', '67356', '2026-10-09', '1', '0', '0', '2026-10-09 15:20:17','اضافة فاتورة مشتريات رقم 95','1','0',null,'0','95','buyBillController.php?do=details&id=95'); -- id=1809
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1809', '382', '67356', '','0'); -- id=1840
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20083903.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';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1809', '618', '67356', '','0'); -- id=1809
UPDATE accountstree SET name = 'اون لاين', customName = 'اون لاين', customNameEn = 'اون لاين', nameEn = 'اون لاين', parent = '81', accountNature = '1', theValue = '67356', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 15:06:57' WHERE id = '618';
update buybill set dailyentryid='1809,0' where buybillid=95;
COMMIT;
UPDATE product SET overAllAveragePrice = 279 WHERE productId = 1797;UPDATE product SET overAllAveragePrice = 234 WHERE productId = 1799;UPDATE product SET overAllAveragePrice = 288 WHERE productId = 1800;UPDATE product SET overAllAveragePrice = 270 WHERE productId = 1801;UPDATE product SET overAllAveragePrice = 324 WHERE productId = 1802;UPDATE product SET overAllAveragePrice = 279 WHERE productId = 1803;UPDATE product SET overAllAveragePrice = 279 WHERE productId = 1804;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:50:17";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:20:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:20:17', '1', 'editprint', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=95'); -- id=6099
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:50:32";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:20:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:20:32', '1', 'showbarcodebuybill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=95&type=2'); -- id=6100
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:54:14";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:24:14", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:24:14', '2', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6101

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8d95a55cc0
-- ----------------------------------------------------------------------------------------------------

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

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:54:14";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:24:14", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:24:14', '2', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6102
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:55:58";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:25:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:25:58', '1', 'editprint', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=95'); -- id=6103
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:56:19";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:56:23";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:26:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 15:26:23', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6104
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:56:23";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 15:26:23', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6105
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:56:45";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:26:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:26:45', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=6106
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:56:58";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:26:58", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:26:58', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6107
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:57:07";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:27:07", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:27:07', '2', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6108

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8dcee9318c
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 15:27:07', '06ac8dcee9318c', '1', '0.00', '0', '0', '1', '5690.00', '5690', '5690', '0', '1', '2026-10-09 15:27:07', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '16' ,'0','','','','','-1','0','0','0','0','0','5690','0','','0','0','5690','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=338
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','338', '0', '2026-10-09 15:27:07', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '5690', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 15:27:07','0','0','',''); -- id=446
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('315','09799', '338', '21', '866', '10', '335', '3350', '0', '', '0', '2026-10-09 15:27:07', '866', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','335','3350','0','','0','0.00','0','0','0','0'); -- id=1190
UPDATE sellbilldetail SET  lastbuyprice = 315.00 , meanbuyprice = 315.00, lastbuyprice_withDiscount = 315.00, meanbuyprice_withDiscount = 315.00
        , lastbuyprice_withTax = 315, meanbuyprice_withTax = 315, lastbuyprice_withDiscountAndTax = 315
                where sellbilldetailid = 1190;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (866, '2026-10-09', 3350, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3350, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3350, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3350, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '97', userid = '2', storedetaildate = '2026-10-09 15:27:07' WHERE storedetailid = '866';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('866', '1', '10', '1', '338', 'اضافة فاتورة مبيعات', 'sellbillController.php', '107', '97', '2', '2026-10-09 15:27:07','0','0'); -- id=4110
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 72;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01380', '338', '94', '1380', '6', '390', '2340', '0', '', '0', '2026-10-09 15:27:07', '1380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','72-6,','1','1','0','0','390','2340','0','','0','0.00','0','0','0','0'); -- id=1191
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1191;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-09', 2340, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2340, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '588', userid = '2', storedetaildate = '2026-10-09 15:27:07' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '6', '1', '338', 'اضافة فاتورة مبيعات', 'sellbillController.php', '594', '588', '2', '2026-10-09 15:27:07','0','0'); -- id=4111
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1944943',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1939253','5690', '0', '2', 'اضافة فاتورة مبيعات', '338', '1944943', '2026-10-09 15:27:07', '2',  'sellbillController.php','1','','0'); -- id=384
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5690', '5690', '2026-10-09', '2', '0', '0', '2026-10-09 15:27:07','اضافة فاتورة مبيعات رقم 338','1','0',null,'0','338','sellbillController.php?do=showDetail&sellbillid=338'); -- id=1812
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1812', '419', '5690', '','0'); -- id=1843
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1944940', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1812', '143', '5690', '','0'); -- id=1812
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3486910', 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 ( '5250', '5250', '2026-10-09', '2', '0', '0', '2026-10-09 15:27:07','اضافة فاتورة مبيعات رقم 338 - صرف البضاعة من المخزن','1','0',null,'0','338','sellbillController.php?do=showDetail&sellbillid=338'); -- id=1813
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1813', '402', '5250', '','0'); -- id=1844
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3281838.05', 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 ('1813', '382', '5250', '','0'); -- id=1813
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20074333.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='1812,0,1813' where sellbillid=338;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 5690, 5250, 5250
                    , 5250, 5250, 5250, 5250
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5250, 5250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5690, sellCostBuyPrice =sellCostBuyPrice+5250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5690, 5250, 5250
                    , 5250, 5250, 5250, 5250
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5250, 5250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5690, sellCostBuyPrice =sellCostBuyPrice+5250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5250
                        , returnSellVal = returnSellVal+0, 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, 5690, 5250, 5250
                    , 5250, 5250, 5250, 5250, 5250, 5250)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5690, netSellCostBuyPrice = netSellCostBuyPrice+5250
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5250
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5250
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5250
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5250
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5250
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5250
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5250;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:57:09";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:27:09", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:27:09', '2', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6109
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:57:20";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:27:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:27:20', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=6110
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:57:20";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:27:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:27:20', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=6111
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:57:30";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:27:30", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:27:30', '3', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6112

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8d946dcb74
-- ----------------------------------------------------------------------------------------------------

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

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:57:30";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:27:30", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:27:30', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6113
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:57:38";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:27:38", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:27:38', '2', 'showDetail', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=338'); -- id=6114
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:57:45";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:27:45", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:27:45', '2', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6115
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:57:55";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:27:55", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:27:55', '3', 'showDetail', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=339'); -- id=6116
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 11:58:19";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:28:19", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:28:19', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6117
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:01:20";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:31:20", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:31:20', '2', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6118

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8ddc2083f3
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 15:31:20', '06ac8ddc2083f3', '1', '0.00', '0', '0', '1', '10590.00', '10590', '10590', '0', '1', '2026-10-09 15:31:20', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '27' ,'0','','','','','-1','0','0','0','0','0','10590','0','','0','0','10590','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=340
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','340', '0', '2026-10-09 15:31:20', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10590', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 15:31:20','0','0','',''); -- id=448
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 425;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('372','01584', '340', '115', '1584', '12', '400', '4800', '0', '', '0', '2026-10-09 15:31:20', '1584', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','425-12,','1','1','0','0','400','4800','0','','0','0.00','0','0','0','0'); -- id=1193
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 372.00, meanbuyprice_withDiscount = 372.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 372
                where sellbilldetailid = 1193;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1584, '2026-10-09', 4800, 4800, 4800
                    , 4800, 4464, 4464, 4464
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4800, 4800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4800, sellCostBuyPrice =sellCostBuyPrice+4800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4464, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4464
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4464
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4800, 4800, 4800
                    , 4800, 4464, 4464, 4464
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4800, 4800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4800, sellCostBuyPrice =sellCostBuyPrice+4800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4464, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4464
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4464
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 15:31:20' WHERE storedetailid = '1609';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1584', '1', '12', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '9', '2', '2026-10-09 15:31:20','0','0'); -- id=4113
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 505;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('362.7','01659', '340', '125', '1659', '3', '390', '1170', '0', '', '0', '2026-10-09 15:31:20', '1659', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','505-3,','1','1','0','0','390','1170','0','','0','0.00','0','0','0','0'); -- id=1194
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 362.70, meanbuyprice_withDiscount = 362.70
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 362.7
                where sellbilldetailid = 1194;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1659, '2026-10-09', 1170, 1170, 1170
                    , 1170, 1088.1, 1088.1, 1088.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1088.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1088.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1088.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1170
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1170, 1170, 1170
                    , 1170, 1088.1, 1088.1, 1088.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1088.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1088.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1088.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1170
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '180', userid = '2', storedetaildate = '2026-10-09 15:31:20' WHERE storedetailid = '2671';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1659', '1', '3', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '183', '180', '2', '2026-10-09 15:31:20','0','0'); -- id=4114
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 501;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('344.1','01656', '340', '125', '1656', '6', '370', '2220', '0', '', '0', '2026-10-09 15:31:20', '1656', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','501-6,','1','1','0','0','370','2220','0','','0','0.00','0','0','0','0'); -- id=1195
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 344.10, meanbuyprice_withDiscount = 344.10
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 344.1
                where sellbilldetailid = 1195;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1656, '2026-10-09', 2220, 2220, 2220
                    , 2220, 2064.6, 2064.6, 2064.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2220, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2064.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2064.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2064.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2220, 2220, 2220
                    , 2220, 2064.6, 2064.6, 2064.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2220, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2064.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2064.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2064.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '63', userid = '2', storedetaildate = '2026-10-09 15:31:20' WHERE storedetailid = '2668';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1656', '1', '6', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '69', '63', '2', '2026-10-09 15:31:20','0','0'); -- id=4115
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 74;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','01382', '340', '94', '1382', '6', '400', '2400', '0', '', '0', '2026-10-09 15:31:20', '1382', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','74-6,','1','1','0','0','400','2400','0','','0','0.00','0','0','0','0'); -- id=1196
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1196;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1382, '2026-10-09', 2400, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2400, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '57', userid = '2', storedetaildate = '2026-10-09 15:31:20' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '6', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '63', '57', '2', '2026-10-09 15:31:20','0','0'); -- id=4116
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1956733',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1946143','10590', '0', '2', 'اضافة فاتورة مبيعات', '340', '1956733', '2026-10-09 15:31:20', '2',  'sellbillController.php','1','','0'); -- id=386
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10590', '10590', '2026-10-09', '2', '0', '0', '2026-10-09 15:31:20','اضافة فاتورة مبيعات رقم 340','1','0',null,'0','340','sellbillController.php?do=showDetail&sellbillid=340'); -- id=1816
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1816', '419', '10590', '','0'); -- id=1847
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1956730', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1816', '143', '10590', '','0'); -- id=1816
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3498700', 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 ( '9776.7', '9776.7', '2026-10-09', '2', '0', '0', '2026-10-09 15:31:20','اضافة فاتورة مبيعات رقم 340 - صرف البضاعة من المخزن','1','0',null,'0','340','sellbillController.php?do=showDetail&sellbillid=340'); -- id=1817
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1817', '402', '9776.7', '','0'); -- id=1848
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3292694.75', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1817', '382', '9776.7', '','0'); -- id=1817
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20063476.45', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1816,0,1817' where sellbillid=340;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 10590, 10350, 10350
                    , 10350, 9776.7, 9776.7, 9776.7
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10350, 10350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10590, sellCostBuyPrice =sellCostBuyPrice+10350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9776.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9776.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9776.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 10590, 10350, 10350
                    , 10350, 9776.7, 9776.7, 9776.7
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10350, 10350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10590, sellCostBuyPrice =sellCostBuyPrice+10350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9776.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9776.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9776.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10350
                        , returnSellVal = returnSellVal+0, 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, 10590, 10350, 10350
                    , 10350, 9776.7, 9776.7, 9776.7, 10350, 10350)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10590, netSellCostBuyPrice = netSellCostBuyPrice+10350
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+10350
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+10350
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+9776.7
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+9776.7
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+9776.7
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+10350
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+10350;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:01:21";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:31:21", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:31:21', '2', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6119
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:01:34";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:31:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 15:31:34', '1', 'oneSupplier', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6120
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:01:57";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:31:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 15:31:57', '1', 'oneSupplier', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6121
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:02:27";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:32:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:32:27', '1', 'details', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=details&id=69'); -- id=6122
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:03:11";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:33:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:33:11', '1', 'add', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=6123
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 ('بوكس تطريز جلد ايه ثري ','','122','490','490','490','490','2026-10-09','0','1','0','','0','0','0','0','0','490','490','490','490','490','0','0','0','0','.','0','0','0','490','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','490','490','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','490','0','0','0','0','0','0','','','0','0','0','0'); -- id=1805
UPDATE product SET productName = 'بوكس تطريز جلد ايه ثري ', productDescription = '', productCatId = '122', productBuyPrice = '490', productSellAllPrice = '490', productSellUnitPrice = '490', productSellHalfPrice = '490', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01805',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '490',lastbuyprice_withDiscount = '490',meanbuyprice = '490',meanbuyprice_withDiscount = '490' , productbuypricereal = '490' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='490',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='490',meanbuyprice_withTax='490',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='490',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1805';
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', '1805', '1.00', '2026-10-09', '1', '0','0180501','490','490','490','490','','0','0','0','0','0','0','0','0','0','0'); -- id=1805
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1805', '1', '0', '1', '2026-10-09'); -- id=2819
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1805', '1', '0', '0', '1805', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4117
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1805, 1,'2026-10-09 15:33:11',1)
                ON DUPLICATE KEY UPDATE productid = 1805, edited = 1, sysdate = '2026-10-09 15:33:11', userid = 1; -- id=2725
UPDATE product SET productName = 'بوكس تطريز جلد ايه ثري ', productDescription = '', productCatId = '122', productBuyPrice = '490.00', productSellAllPrice = '490.00', productSellUnitPrice = '490.00', productSellHalfPrice = '490.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01805',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '490',lastbuyprice_withDiscount = '490',meanbuyprice = '490',meanbuyprice_withDiscount = '490' , productbuypricereal = '490' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='490',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='490',meanbuyprice_withTax='490',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='490',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1805';
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 ('زنط تطريز جلد ايه ثري','','122','330','330','330','330','2026-10-09','0','1','0','','0','0','0','0','0','330','330','330','330','330','0','0','0','0','.','0','0','0','330','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','330','330','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','330','0','0','0','0','0','0','','','0','0','0','0'); -- id=1806
UPDATE product SET productName = 'زنط تطريز جلد ايه ثري', productDescription = '', productCatId = '122', productBuyPrice = '330', productSellAllPrice = '330', productSellUnitPrice = '330', productSellHalfPrice = '330', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01806',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '330',lastbuyprice_withDiscount = '330',meanbuyprice = '330',meanbuyprice_withDiscount = '330' , productbuypricereal = '330' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='330',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='330',meanbuyprice_withTax='330',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='330',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1806';
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', '1806', '1.00', '2026-10-09', '1', '0','0180601','330','330','330','330','','0','0','0','0','0','0','0','0','0','0'); -- id=1806
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1806', '1', '0', '1', '2026-10-09'); -- id=2820
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1806', '1', '0', '0', '1806', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4118
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1806, 1,'2026-10-09 15:33:11',1)
                ON DUPLICATE KEY UPDATE productid = 1806, edited = 1, sysdate = '2026-10-09 15:33:11', userid = 1; -- id=2726
UPDATE product SET productName = 'زنط تطريز جلد ايه ثري', productDescription = '', productCatId = '122', productBuyPrice = '330.00', productSellAllPrice = '330.00', productSellUnitPrice = '330.00', productSellHalfPrice = '330.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01806',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '330',lastbuyprice_withDiscount = '330',meanbuyprice = '330',meanbuyprice_withDiscount = '330' , productbuypricereal = '330' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='330',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='330',meanbuyprice_withTax='330',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='330',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1806';
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 ('طباعه فوم ايه ثري','','122','450','450','450','450','2026-10-09','0','1','0','','0','0','0','0','0','450','450','450','450','450','0','0','0','0','.','0','0','0','450','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','450','450','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','450','0','0','0','0','0','0','','','0','0','0','0'); -- id=1807
UPDATE product SET productName = 'طباعه فوم ايه ثري', productDescription = '', productCatId = '122', productBuyPrice = '450', productSellAllPrice = '450', productSellUnitPrice = '450', productSellHalfPrice = '450', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01807',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='450',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='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1807';
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', '1807', '1.00', '2026-10-09', '1', '0','0180701','450','450','450','450','','0','0','0','0','0','0','0','0','0','0'); -- id=1807
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1807', '1', '0', '1', '2026-10-09'); -- id=2821
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1807', '1', '0', '0', '1807', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4119
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1807, 1,'2026-10-09 15:33:11',1)
                ON DUPLICATE KEY UPDATE productid = 1807, edited = 1, sysdate = '2026-10-09 15:33:11', userid = 1; -- id=2727
UPDATE product SET productName = 'طباعه فوم ايه ثري', productDescription = '', productCatId = '122', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01807',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='450',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='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1807';
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 ('بوكس سوسته ايه ثري ','','122','470','470','470','470','2026-10-09','0','1','0','','0','0','0','0','0','470','470','470','470','470','0','0','0','0','.','0','0','0','470','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','470','470','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','470','0','0','0','0','0','0','','','0','0','0','0'); -- id=1808
UPDATE product SET productName = 'بوكس سوسته ايه ثري ', productDescription = '', productCatId = '122', productBuyPrice = '470', productSellAllPrice = '470', productSellUnitPrice = '470', productSellHalfPrice = '470', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01808',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '470',lastbuyprice_withDiscount = '470',meanbuyprice = '470',meanbuyprice_withDiscount = '470' , productbuypricereal = '470' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='470',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='470',meanbuyprice_withTax='470',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='470',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1808';
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', '1808', '1.00', '2026-10-09', '1', '0','0180801','470','470','470','470','','0','0','0','0','0','0','0','0','0','0'); -- id=1808
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1808', '1', '0', '1', '2026-10-09'); -- id=2822
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1808', '1', '0', '0', '1808', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4120
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1808, 1,'2026-10-09 15:33:11',1)
                ON DUPLICATE KEY UPDATE productid = 1808, edited = 1, sysdate = '2026-10-09 15:33:11', userid = 1; -- id=2728
UPDATE product SET productName = 'بوكس سوسته ايه ثري ', productDescription = '', productCatId = '122', productBuyPrice = '470.00', productSellAllPrice = '470.00', productSellUnitPrice = '470.00', productSellHalfPrice = '470.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01808',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '470',lastbuyprice_withDiscount = '470',meanbuyprice = '470',meanbuyprice_withDiscount = '470' , productbuypricereal = '470' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='470',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='470',meanbuyprice_withTax='470',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='470',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1808';
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 ('زنط تطريز كم ايه ثري','','122','350','350','350','350','2026-10-09','0','1','0','','0','0','0','0','0','350','350','350','350','350','0','0','0','0','.','0','0','0','350','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','350','350','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','350','0','0','0','0','0','0','','','0','0','0','0'); -- id=1809
UPDATE product SET productName = 'زنط تطريز كم ايه ثري', productDescription = '', productCatId = '122', productBuyPrice = '350', productSellAllPrice = '350', productSellUnitPrice = '350', productSellHalfPrice = '350', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01809',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',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='350',meanbuyprice_withTax='350',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='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1809';
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', '1809', '1.00', '2026-10-09', '1', '0','0180901','350','350','350','350','','0','0','0','0','0','0','0','0','0','0'); -- id=1809
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1809', '1', '0', '1', '2026-10-09'); -- id=2823
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1809', '1', '0', '0', '1809', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4121
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1809, 1,'2026-10-09 15:33:11',1)
                ON DUPLICATE KEY UPDATE productid = 1809, edited = 1, sysdate = '2026-10-09 15:33:11', userid = 1; -- id=2729
UPDATE product SET productName = 'زنط تطريز كم ايه ثري', productDescription = '', productCatId = '122', productBuyPrice = '350.00', productSellAllPrice = '350.00', productSellUnitPrice = '350.00', productSellHalfPrice = '350.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01809',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',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='350',meanbuyprice_withTax='350',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='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1809';
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 ('شريط ايه ايه ثري','','122','480','480','480','480','2026-10-09','0','1','0','','0','0','0','0','0','480','480','480','480','480','0','0','0','0','.','0','0','0','480','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','480','480','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','480','0','0','0','0','0','0','','','0','0','0','0'); -- id=1810
UPDATE product SET productName = 'شريط ايه ايه ثري', productDescription = '', productCatId = '122', productBuyPrice = '480', productSellAllPrice = '480', productSellUnitPrice = '480', productSellHalfPrice = '480', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01810',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '480',meanbuyprice = '480',meanbuyprice_withDiscount = '480' , productbuypricereal = '480' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',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='480',meanbuyprice_withTax='480',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='480',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1810';
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', '1810', '1.00', '2026-10-09', '1', '0','0181001','480','480','480','480','','0','0','0','0','0','0','0','0','0','0'); -- id=1810
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1810', '1', '0', '1', '2026-10-09'); -- id=2824
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1810', '1', '0', '0', '1810', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4122
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1810, 1,'2026-10-09 15:33:11',1)
                ON DUPLICATE KEY UPDATE productid = 1810, edited = 1, sysdate = '2026-10-09 15:33:11', userid = 1; -- id=2730
UPDATE product SET productName = 'شريط ايه ايه ثري', productDescription = '', productCatId = '122', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '480.00', productSellHalfPrice = '480.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01810',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '480',meanbuyprice = '480',meanbuyprice_withDiscount = '480' , productbuypricereal = '480' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',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='480',meanbuyprice_withTax='480',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='480',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1810';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:03:13";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:33:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:33:13', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=6124
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:03:16";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:33:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:33:16', '1', 'bill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6125
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:03:26";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:33:26", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:33:26', '3', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6126

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8dde366521
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8dde366521 and sellbillId = 341 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:03:26";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:33:26", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:33:26', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6127
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:03:37";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:33:37", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:33:37', '3', 'showDetail', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=341'); -- id=6128
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:04:26";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:34:27", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:34:27', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6129
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:06:36";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:36:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:36:36', '1', 'add', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=6130
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 ('06ac8df0c26e6a', '2026-10-09 15:33:16', '121', '91260.00', '169857', '10', '1', '87330.00',  '78597.00', '0', '78597', '1', '2026-10-09 15:36:36', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=96
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 ('01805', '96', '122', '1805', '24', '490', '11760.00', '0', '', '2026-10-09 15:36:36', '1805','','','0','0','0','0','0',null,'490','11760','0','0','0','0','0','0','0','0','1'); -- id=620
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 15:33:16', 1, 1805, 0, 0
                    , 441, 24, 0, 0, 1, '2026-10-09 15:36:36')
                ON DUPLICATE KEY UPDATE buyprice = 441,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 15:36:36' ; -- id=788
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1805', '490', '24', '0', 'buyBillController.php', '620', '', '0', '0'); -- id=495
UPDATE product SET  productBuyPrice = "490" WHERE productId = 1805 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 620 ;
UPDATE product SET productName = 'بوكس تطريز جلد ايه ثري ', productDescription = '', productCatId = '122', productBuyPrice = '490.00', productSellAllPrice = '490.00', productSellUnitPrice = '490.00', productSellHalfPrice = '490.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01805',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '490',lastbuyprice_withDiscount = '441',meanbuyprice = '490',meanbuyprice_withDiscount = '441' , productbuypricereal = '490.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='490',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='490',meanbuyprice_withTax='490',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='441',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1805';
UPDATE buybilldetail SET  lastbuyprice = 490 , meanbuyprice = 490, lastbuyprice_withDiscount = 441, meanbuyprice_withDiscount = 441
        , lastbuyprice_withTax = 490, meanbuyprice_withTax = 490, lastbuyprice_withDiscountAndTax = 441
                where buybilldetailid = 620;
UPDATE productunit SET proUnitBuyPrice  = 490 * productnumber WHERE productid = 1805;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2819';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1805', '1', '24', '0', '96', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 15:33:16','0','0'); -- id=4124
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 ('01806', '96', '122', '1806', '51', '330', '16830.00', '0', '', '2026-10-09 15:36:36', '1806','','','0','0','0','0','0',null,'330','16830','0','0','0','0','0','0','0','0','1'); -- id=621
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 15:33:16', 1, 1806, 0, 0
                    , 297, 51, 0, 0, 1, '2026-10-09 15:36:36')
                ON DUPLICATE KEY UPDATE buyprice = 297,
                        buyQuantity =buyQuantity+51, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 15:36:36' ; -- id=789
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1806', '330', '51', '0', 'buyBillController.php', '621', '', '0', '0'); -- id=496
UPDATE product SET  productBuyPrice = "330" WHERE productId = 1806 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 621 ;
UPDATE product SET productName = 'زنط تطريز جلد ايه ثري', productDescription = '', productCatId = '122', productBuyPrice = '330.00', productSellAllPrice = '330.00', productSellUnitPrice = '330.00', productSellHalfPrice = '330.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01806',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '330',lastbuyprice_withDiscount = '297',meanbuyprice = '330',meanbuyprice_withDiscount = '297' , productbuypricereal = '330.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='330',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='330',meanbuyprice_withTax='330',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='297',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1806';
UPDATE buybilldetail SET  lastbuyprice = 330 , meanbuyprice = 330, lastbuyprice_withDiscount = 297, meanbuyprice_withDiscount = 297
        , lastbuyprice_withTax = 330, meanbuyprice_withTax = 330, lastbuyprice_withDiscountAndTax = 297
                where buybilldetailid = 621;
UPDATE productunit SET proUnitBuyPrice  = 330 * productnumber WHERE productid = 1806;
UPDATE storedetail SET  productquantity = '51', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2820';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1806', '1', '51', '0', '96', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '51', '1', '2026-10-09 15:33:16','0','0'); -- id=4125
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 ('01807', '96', '122', '1807', '39', '450', '17550.00', '0', '', '2026-10-09 15:36:36', '1807','','','0','0','0','0','0',null,'450','17550','0','0','0','0','0','0','0','0','1'); -- id=622
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 15:33:16', 1, 1807, 0, 0
                    , 405, 39, 0, 0, 1, '2026-10-09 15:36:36')
                ON DUPLICATE KEY UPDATE buyprice = 405,
                        buyQuantity =buyQuantity+39, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 15:36:36' ; -- id=790
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1807', '450', '39', '0', 'buyBillController.php', '622', '', '0', '0'); -- id=497
UPDATE product SET  productBuyPrice = "450" WHERE productId = 1807 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 622 ;
UPDATE product SET productName = 'طباعه فوم ايه ثري', productDescription = '', productCatId = '122', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01807',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '405',meanbuyprice = '450',meanbuyprice_withDiscount = '405' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='450',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='405',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1807';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 405, meanbuyprice_withDiscount = 405
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 405
                where buybilldetailid = 622;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 1807;
UPDATE storedetail SET  productquantity = '39', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2821';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1807', '1', '39', '0', '96', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '39', '1', '2026-10-09 15:33:16','0','0'); -- id=4126
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 ('01808', '96', '122', '1808', '33', '470', '15510.00', '0', '', '2026-10-09 15:36:36', '1808','','','0','0','0','0','0',null,'470','15510','0','0','0','0','0','0','0','0','1'); -- id=623
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 15:33:16', 1, 1808, 0, 0
                    , 423, 33, 0, 0, 1, '2026-10-09 15:36:36')
                ON DUPLICATE KEY UPDATE buyprice = 423,
                        buyQuantity =buyQuantity+33, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 15:36:36' ; -- id=791
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1808', '470', '33', '0', 'buyBillController.php', '623', '', '0', '0'); -- id=498
UPDATE product SET  productBuyPrice = "470" WHERE productId = 1808 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 623 ;
UPDATE product SET productName = 'بوكس سوسته ايه ثري ', productDescription = '', productCatId = '122', productBuyPrice = '470.00', productSellAllPrice = '470.00', productSellUnitPrice = '470.00', productSellHalfPrice = '470.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01808',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '470',lastbuyprice_withDiscount = '423',meanbuyprice = '470',meanbuyprice_withDiscount = '423' , productbuypricereal = '470.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='470',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='470',meanbuyprice_withTax='470',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='423',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1808';
UPDATE buybilldetail SET  lastbuyprice = 470 , meanbuyprice = 470, lastbuyprice_withDiscount = 423, meanbuyprice_withDiscount = 423
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 423
                where buybilldetailid = 623;
UPDATE productunit SET proUnitBuyPrice  = 470 * productnumber WHERE productid = 1808;
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2822';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1808', '1', '33', '0', '96', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '33', '1', '2026-10-09 15:33:16','0','0'); -- id=4127
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 ('01809', '96', '122', '1809', '24', '350', '8400.00', '0', '', '2026-10-09 15:36:36', '1809','','','0','0','0','0','0',null,'350','8400','0','0','0','0','0','0','0','0','1'); -- id=624
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 15:33:16', 1, 1809, 0, 0
                    , 315, 24, 0, 0, 1, '2026-10-09 15:36:36')
                ON DUPLICATE KEY UPDATE buyprice = 315,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 15:36:36' ; -- id=792
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1809', '350', '24', '0', 'buyBillController.php', '624', '', '0', '0'); -- id=499
UPDATE product SET  productBuyPrice = "350" WHERE productId = 1809 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 624 ;
UPDATE product SET productName = 'زنط تطريز كم ايه ثري', productDescription = '', productCatId = '122', productBuyPrice = '350.00', productSellAllPrice = '350.00', productSellUnitPrice = '350.00', productSellHalfPrice = '350.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01809',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '315',meanbuyprice = '350',meanbuyprice_withDiscount = '315' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',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='350',meanbuyprice_withTax='350',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='315',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1809';
UPDATE buybilldetail SET  lastbuyprice = 350 , meanbuyprice = 350, lastbuyprice_withDiscount = 315, meanbuyprice_withDiscount = 315
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 315
                where buybilldetailid = 624;
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 1809;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2823';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1809', '1', '24', '0', '96', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 15:33:16','0','0'); -- id=4128
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 ('01810', '96', '122', '1810', '36', '480', '17280.00', '0', '', '2026-10-09 15:36:36', '1810','','','0','0','0','0','0',null,'480','17280','0','0','0','0','0','0','0','0','1'); -- id=625
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 15:33:16', 1, 1810, 0, 0
                    , 432, 36, 0, 0, 1, '2026-10-09 15:36:36')
                ON DUPLICATE KEY UPDATE buyprice = 432,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 15:36:36' ; -- id=793
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1810', '480', '36', '0', 'buyBillController.php', '625', '', '0', '0'); -- id=500
UPDATE product SET  productBuyPrice = "480" WHERE productId = 1810 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 625 ;
UPDATE product SET productName = 'شريط ايه ايه ثري', productDescription = '', productCatId = '122', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '480.00', productSellHalfPrice = '480.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01810',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '432',meanbuyprice = '480',meanbuyprice_withDiscount = '432' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',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='480',meanbuyprice_withTax='480',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='432',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1810';
UPDATE buybilldetail SET  lastbuyprice = 480 , meanbuyprice = 480, lastbuyprice_withDiscount = 432, meanbuyprice_withDiscount = 432
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 480, lastbuyprice_withDiscountAndTax = 432
                where buybilldetailid = 625;
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 1810;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2824';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1810', '1', '36', '0', '96', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '1', '2026-10-09 15:33:16','0','0'); -- id=4129
UPDATE supplier SET  suppliercurrentDebt = '169857',suppliercurrentDebtInCurrency= '169857' , userid = '1', supplierdate = '2026-10-09 15:36:36'   WHERE supplierid = '121';
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 ('121', '91260.00', '78597', '0', 'اضافة فاتورة مشتريات', '96', '169857', '2026-10-09 15:33:16', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','78597','1','91260','78597','169857','0',''); -- id=293
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '78597', '78597', '2026-10-09', '1', '0', '0', '2026-10-09 15:36:36','اضافة فاتورة مشتريات رقم 96','1','0',null,'0','96','buyBillController.php?do=details&id=96'); -- id=1820
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1820', '382', '78597', '','0'); -- id=1851
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20136403.45', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1820', '604', '78597', '','0'); -- id=1820
UPDATE accountstree SET name = 'ايه ثري', customName = 'ايه ثري', customNameEn = 'ايه ثري', nameEn = 'ايه ثري', parent = '81', accountNature = '1', theValue = '169857', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 11:12:01' WHERE id = '604';
update buybill set dailyentryid='1820,0' where buybillid=96;
COMMIT;
UPDATE product SET overAllAveragePrice = 441 WHERE productId = 1805;UPDATE product SET overAllAveragePrice = 297 WHERE productId = 1806;UPDATE product SET overAllAveragePrice = 405 WHERE productId = 1807;UPDATE product SET overAllAveragePrice = 423 WHERE productId = 1808;UPDATE product SET overAllAveragePrice = 315 WHERE productId = 1809;UPDATE product SET overAllAveragePrice = 432 WHERE productId = 1810;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:06:36";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:36:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:36:36', '1', 'editprint', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=96'); -- id=6131
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:06:47";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:36:47", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:36:47', '4', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6132

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8d8b8b61d1
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 15:36:47', '06ac8d8b8b61d1', '1', '0.00', '0', '0', '1', '9800.00', '9800', '9800', '0', '2', '2026-10-09 15:36:47', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '24' ,'0','','','','','-1','0','0','0','0','0','9800','0','','0','0','9800','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=342
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','342', '0', '2026-10-09 15:36:47', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '9800', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 15:36:47','0','0','',''); -- id=450
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 147;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('400','01356', '342', '88', '1356', '12', '420', '5040', '0', '', '0', '2026-10-09 15:36:47', '1356', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','147-12,','1','1','0','0','420','5040','0','','0','0.00','0','0','0','0'); -- id=1198
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 400.00, meanbuyprice_withDiscount = 400.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 400
                where sellbilldetailid = 1198;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1356, '2026-10-09', 5040, 4800, 4800
                    , 4800, 4800, 4800, 4800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4800, 4800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5040, sellCostBuyPrice =sellCostBuyPrice+4800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-09', 5040, 4800, 4800
                    , 4800, 4800, 4800, 4800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4800, 4800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5040, sellCostBuyPrice =sellCostBuyPrice+4800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '33', userid = '4', storedetaildate = '2026-10-09 15:36:47' WHERE storedetailid = '1413';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1356', '2', '12', '1', '342', 'اضافة فاتورة مبيعات', 'sellbillController.php', '45', '33', '4', '2026-10-09 15:36:47','0','0'); -- id=4130
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 224;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('380','01443', '342', '88', '1443', '4', '410', '1640', '0', '', '0', '2026-10-09 15:36:47', '1443', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','224-4,','1','1','0','0','410','1640','0','','0','0.00','0','0','0','0'); -- id=1199
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 1199;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1443, '2026-10-09', 1640, 1520, 1520
                    , 1520, 1520, 1520, 1520
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1520, 1520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1640, sellCostBuyPrice =sellCostBuyPrice+1520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1640, 1520, 1520
                    , 1520, 1520, 1520, 1520
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1520, 1520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1640, sellCostBuyPrice =sellCostBuyPrice+1520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '4', storedetaildate = '2026-10-09 15:36:47' WHERE storedetailid = '1474';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1443', '2', '4', '1', '342', 'اضافة فاتورة مبيعات', 'sellbillController.php', '19', '15', '4', '2026-10-09 15:36:47','0','0'); -- id=4131
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01324', '342', '86', '1324', '8', '390', '3120', '0', '', '0', '2026-10-09 15:36:47', '1324', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','131-8,','1','1','0','0','390','3120','0','','0','0.00','0','0','0','0'); -- id=1200
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1200;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1324, '2026-10-09', 3120, 2800, 2800
                    , 2800, 2800, 2800, 2800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3120, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 3120, 2800, 2800
                    , 2800, 2800, 2800, 2800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3120, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '680', userid = '4', storedetaildate = '2026-10-09 15:36:47' WHERE storedetailid = '1405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '2', '8', '1', '342', 'اضافة فاتورة مبيعات', 'sellbillController.php', '688', '680', '4', '2026-10-09 15:36:47','0','0'); -- id=4132
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '467770',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('457970','9800', '0', '3', 'اضافة فاتورة مبيعات', '342', '467770', '2026-10-09 15:36:47', '4',  'sellbillController.php','1','','0'); -- id=388
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '9800', '9800', '2026-10-09', '4', '0', '0', '2026-10-09 15:36:47','اضافة فاتورة مبيعات رقم 342','1','0',null,'0','342','sellbillController.php?do=showDetail&sellbillid=342'); -- id=1821
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1821', '501', '9800', '','0'); -- id=1852
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '467770', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1821', '143', '9800', '','0'); -- id=1821
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3514450', 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 ( '9120', '9120', '2026-10-09', '4', '0', '0', '2026-10-09 15:36:47','اضافة فاتورة مبيعات رقم 342 - صرف البضاعة من المخزن','1','0',null,'0','342','sellbillController.php?do=showDetail&sellbillid=342'); -- id=1822
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1822', '402', '9120', '','0'); -- id=1853
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3307484.75', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1822', '492', '9120', '','0'); -- id=1822
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '724685', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1821,0,1822' where sellbillid=342;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 9800, 9120, 9120
                    , 9120, 9120, 9120, 9120
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9120, 9120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9800, sellCostBuyPrice =sellCostBuyPrice+9120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 9800, 9120, 9120
                    , 9120, 9120, 9120, 9120
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9120, 9120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9800, sellCostBuyPrice =sellCostBuyPrice+9120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9120
                        , returnSellVal = returnSellVal+0, 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, 9800, 9120, 9120
                    , 9120, 9120, 9120, 9120, 9120, 9120)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+9800, netSellCostBuyPrice = netSellCostBuyPrice+9120
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+9120
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+9120
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+9120
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+9120
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+9120
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+9120
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+9120;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8d8b8b61d1 and sellbillId = 342 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:06:49";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:36:49", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:36:49', '4', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6133
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:08:00";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:38:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:38:00', '1', 'showbarcodebuybill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=96&type=2'); -- id=6134
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:08:32";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:38:32", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:38:32', '6', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6135

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8d60791172
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 15:38:32', '06ac8d60791172', '1', '0.00', '0', '0', '1', '1500.00', '1500', '1500', '0', '1', '2026-10-09 15:38:32', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '3' ,'0','','','','','-1','0','0','0','0','0','1500','0','','0','0','1500','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=343
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','343', '0', '2026-10-09 15:38:32', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1500', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 15:38:32','0','0','',''); -- id=451
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 55;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('440','01370', '343', '91', '1370', '3', '500', '1500', '0', '', '0', '2026-10-09 15:38:32', '1370', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','55-3,','1','1','0','0','500','1500','0','','0','0.00','0','0','0','0'); -- id=1201
UPDATE sellbilldetail SET  lastbuyprice = 440.00 , meanbuyprice = 440.00, lastbuyprice_withDiscount = 440.00, meanbuyprice_withDiscount = 440.00
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 440
                where sellbilldetailid = 1201;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1370, '2026-10-09', 1500, 1320, 1320
                    , 1320, 1320, 1320, 1320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1320, 1320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1500, sellCostBuyPrice =sellCostBuyPrice+1320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1320
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1500, 1320, 1320
                    , 1320, 1320, 1320, 1320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1320, 1320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1500, sellCostBuyPrice =sellCostBuyPrice+1320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1320
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '66', userid = '6', storedetaildate = '2026-10-09 15:38:32' WHERE storedetailid = '1370';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1370', '1', '3', '1', '343', 'اضافة فاتورة مبيعات', 'sellbillController.php', '69', '66', '6', '2026-10-09 15:38:32','0','0'); -- id=4133
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '88295',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('86795','1500', '0', '4', 'اضافة فاتورة مبيعات', '343', '88295', '2026-10-09 15:38:32', '6',  'sellbillController.php','1','','0'); -- id=389
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1500', '1500', '2026-10-09', '6', '0', '0', '2026-10-09 15:38:32','اضافة فاتورة مبيعات رقم 343','1','0',null,'0','343','sellbillController.php?do=showDetail&sellbillid=343'); -- id=1823
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1823', '568', '1500', '','0'); -- id=1854
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '88295', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1823', '143', '1500', '','0'); -- id=1823
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3515950', 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 ( '1320', '1320', '2026-10-09', '6', '0', '0', '2026-10-09 15:38:32','اضافة فاتورة مبيعات رقم 343 - صرف البضاعة من المخزن','1','0',null,'0','343','sellbillController.php?do=showDetail&sellbillid=343'); -- id=1824
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1824', '402', '1320', '','0'); -- id=1855
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3308804.75', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1824', '382', '1320', '','0'); -- id=1824
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20135083.45', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1823,0,1824' where sellbillid=343;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 1500, 1320, 1320
                    , 1320, 1320, 1320, 1320
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1320, 1320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1500, sellCostBuyPrice =sellCostBuyPrice+1320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1320
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1500, 1320, 1320
                    , 1320, 1320, 1320, 1320
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1320, 1320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1500, sellCostBuyPrice =sellCostBuyPrice+1320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1320
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1320
                        , returnSellVal = returnSellVal+0, 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, 1500, 1320, 1320
                    , 1320, 1320, 1320, 1320, 1320, 1320)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1500, netSellCostBuyPrice = netSellCostBuyPrice+1320
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1320
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1320
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1320
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1320
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1320
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1320
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1320;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:08:32";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:38:32", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:38:32', '6', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6136
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:10:42";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:40:42", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:40:42', '6', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6137

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8e048edd6d
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 15:40:42', '06ac8e048edd6d', '1', '0.00', '0', '0', '1', '1350.00', '1350', '1350', '0', '1', '2026-10-09 15:40:42', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '3' ,'0','','','','','-1','0','0','0','0','0','1350','0','','0','0','1350','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=344
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','344', '0', '2026-10-09 15:40:42', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1350', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 15:40:42','0','0','',''); -- id=452
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 341;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','01497', '344', '108', '1497', '3', '450', '1350', '0', '', '0', '2026-10-09 15:40:42', '1497', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','341-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=1202
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 1202;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1497, '2026-10-09', 1350, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1350, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '6', userid = '6', storedetaildate = '2026-10-09 15:40:42' WHERE storedetailid = '1522';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1497', '1', '3', '1', '344', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '6', '6', '2026-10-09 15:40:42','0','0'); -- id=4134
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '89645',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('88295','1350', '0', '4', 'اضافة فاتورة مبيعات', '344', '89645', '2026-10-09 15:40:42', '6',  'sellbillController.php','1','','0'); -- id=390
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1350', '1350', '2026-10-09', '6', '0', '0', '2026-10-09 15:40:42','اضافة فاتورة مبيعات رقم 344','1','0',null,'0','344','sellbillController.php?do=showDetail&sellbillid=344'); -- id=1825
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1825', '568', '1350', '','0'); -- id=1856
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '89645', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1825', '143', '1350', '','0'); -- id=1825
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3517300', 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 ( '1290', '1290', '2026-10-09', '6', '0', '0', '2026-10-09 15:40:42','اضافة فاتورة مبيعات رقم 344 - صرف البضاعة من المخزن','1','0',null,'0','344','sellbillController.php?do=showDetail&sellbillid=344'); -- id=1826
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1826', '402', '1290', '','0'); -- id=1857
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3310094.75', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1826', '382', '1290', '','0'); -- id=1826
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20133793.45', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1825,0,1826' where sellbillid=344;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 1350, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1350, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, 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, 1350, 1290, 1290
                    , 1290, 1290, 1290, 1290, 1290, 1290)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1350, netSellCostBuyPrice = netSellCostBuyPrice+1290
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1290
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1290
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1290
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1290
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1290
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1290
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1290;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8e048edd6d and sellbillId = 344 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:10:43";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:40:43", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:40:43', '6', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6138
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:12:15";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:42:15", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 15:42:15', '4', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6139
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:12:42";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:42:42", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:42:42', '4', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6140
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:13:11";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:43:11", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:43:11', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6141
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:13:17";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:43:17", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:43:17', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6142
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:13:18";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:43:18", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:43:18', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6143
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:15:10";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:45:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:45:10', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=6144
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:15:24";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:45:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:45:24', '1', 'bill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6145
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:16:02";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:46:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:46:02', '1', 'bill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6146
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:16:47";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:46:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:46:47', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=6147
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:16:51";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:16:58";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:46:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 15:46:58', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6148
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:16:58";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 15:46:58', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6149
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:17:18";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:47:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:47:18', '1', 'bill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6150
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:17:19";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:47:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:47:19', '1', 'bill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6151
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:17:23";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:47:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:47:23', '1', 'bill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6152
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:17:23";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:47:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:47:23', '1', 'bill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6153
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:22:55";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:52:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 15:52:55', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=6154
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:23:01";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:53:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-09 15:53:01', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php'); -- id=6155
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:23:02";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:53:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-09 15:53:02', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=6156
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:23:18";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:53:18", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:53:18', '4', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6157

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8e142b99fe
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 15:53:18', '06ac8e142b99fe', '1', '0.00', '0', '0', '1', '2890.00', '2890', '2890', '0', '2', '2026-10-09 15:53:18', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '7' ,'0','','','','','-1','0','0','0','0','0','2890','0','','0','0','2890','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=345
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','345', '0', '2026-10-09 15:53:18', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2890', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 15:53:18','0','0','',''); -- id=453
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 133;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01325', '345', '87', '1325', '3', '390', '1170', '0', '', '0', '2026-10-09 15:53:18', '1325', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','133-3,','1','1','0','0','390','1170','0','','0','0.00','0','0','0','0'); -- id=1203
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1203;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1325, '2026-10-09', 1170, 1050, 1050
                    , 1050, 1050, 1050, 1050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1050, 1050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1170, 1050, 1050
                    , 1050, 1050, 1050, 1050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1050, 1050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '226', userid = '4', storedetaildate = '2026-10-09 15:53:18' WHERE storedetailid = '1406';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1325', '2', '3', '1', '345', 'اضافة فاتورة مبيعات', 'sellbillController.php', '229', '226', '4', '2026-10-09 15:53:18','0','0'); -- id=4135
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 493;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('370','01550', '345', '112', '1550', '4', '430', '1720', '0', '', '0', '2026-10-09 15:53:18', '1550', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','493-4,','1','1','0','0','430','1720','0','','0','0.00','0','0','0','0'); -- id=1204
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 370.00, meanbuyprice_withDiscount = 370.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 370
                where sellbilldetailid = 1204;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1550, '2026-10-09', 1720, 1480, 1480
                    , 1480, 1480, 1480, 1480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1480, 1480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1720, sellCostBuyPrice =sellCostBuyPrice+1480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1720, 1480, 1480
                    , 1480, 1480, 1480, 1480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1480, 1480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1720, sellCostBuyPrice =sellCostBuyPrice+1480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '146', userid = '4', storedetaildate = '2026-10-09 15:53:18' WHERE storedetailid = '2562';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1550', '2', '4', '1', '345', 'اضافة فاتورة مبيعات', 'sellbillController.php', '150', '146', '4', '2026-10-09 15:53:18','0','0'); -- id=4136
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '470660',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('467770','2890', '0', '3', 'اضافة فاتورة مبيعات', '345', '470660', '2026-10-09 15:53:18', '4',  'sellbillController.php','1','','0'); -- id=391
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2890', '2890', '2026-10-09', '4', '0', '0', '2026-10-09 15:53:18','اضافة فاتورة مبيعات رقم 345','1','0',null,'0','345','sellbillController.php?do=showDetail&sellbillid=345'); -- id=1827
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1827', '501', '2890', '','0'); -- id=1858
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '470660', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1827', '143', '2890', '','0'); -- id=1827
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3520190', 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 ( '2530', '2530', '2026-10-09', '4', '0', '0', '2026-10-09 15:53:18','اضافة فاتورة مبيعات رقم 345 - صرف البضاعة من المخزن','1','0',null,'0','345','sellbillController.php?do=showDetail&sellbillid=345'); -- id=1828
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1828', '402', '2530', '','0'); -- id=1859
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3312624.75', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1828', '492', '2530', '','0'); -- id=1828
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '722155', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1827,0,1828' where sellbillid=345;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 2890, 2530, 2530
                    , 2530, 2530, 2530, 2530
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2530, 2530, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2890, sellCostBuyPrice =sellCostBuyPrice+2530
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2530, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2530
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2530
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2530
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2530
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2530
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2890, 2530, 2530
                    , 2530, 2530, 2530, 2530
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2530, 2530, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2890, sellCostBuyPrice =sellCostBuyPrice+2530
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2530, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2530
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2530
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2530
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2530
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2530
                        , returnSellVal = returnSellVal+0, 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, 2890, 2530, 2530
                    , 2530, 2530, 2530, 2530, 2530, 2530)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2890, netSellCostBuyPrice = netSellCostBuyPrice+2530
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2530
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2530
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2530
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2530
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2530
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2530
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2530;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:23:18";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:53:18", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:53:18', '4', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6158
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:23:44";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:53:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-09 15:53:44', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php'); -- id=6159
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:23:45";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:53:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-09 15:53:45', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=6160
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:23:55";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:23:55";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:23:59";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:53:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 15:53:59', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6161
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:23:59";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 15:53:59', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6162
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:24:13";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:54:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:54:13', '1', 'bill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6163
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:24:13";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:54:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:54:13', '1', 'bill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6164
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:25:40";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:55:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-09 15:55:40', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php'); -- id=6165
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:25:41";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:55:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-09 15:55:41', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=6166
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:26:27";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:56:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-09 15:56:27', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=6167
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:26:34";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:56:34", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:56:34', '4', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=6168
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:26:40";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:56:40", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:56:40', '3', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6169

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8e1662c321
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 15:56:40', '06ac8e1662c321', '1', '0.00', '0', '0', '1', '23955.00', '23955', '23955', '0', '1', '2026-10-09 15:56:40', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '59' ,'0','','','','','-1','0','0','0','0','0','23955','0','','0','0','23955','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=346
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','346', '0', '2026-10-09 15:56:40', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '23955', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 15:56:40','0','0','',''); -- id=454
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 664;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('280','01750', '346', '134', '1750', '8', '300', '2400', '0', '', '0', '2026-10-09 15:56:40', '1750', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','664-8,','1','1','0','0','300','2400','0','','0','0.00','0','0','0','0'); -- id=1205
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 280.00, lastbuyprice_withDiscount = 280.00, meanbuyprice_withDiscount = 280.00
        , lastbuyprice_withTax = 280, meanbuyprice_withTax = 140, lastbuyprice_withDiscountAndTax = 280
                where sellbilldetailid = 1205;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1750, '2026-10-09', 2400, 2240, 2240
                    , 2240, 2240, 2240, 2240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2240, 1120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2400, 2240, 2240
                    , 2240, 2240, 2240, 2240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2240, 1120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '3', storedetaildate = '2026-10-09 15:56:40' WHERE storedetailid = '2763';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1750', '1', '8', '1', '346', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8', '0', '3', '2026-10-09 15:56:40','0','0'); -- id=4137
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 72;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01380', '346', '94', '1380', '9', '390', '3510', '0', '', '0', '2026-10-09 15:56:40', '1380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','72-9,','1','1','0','0','390','3510','0','','0','0.00','0','0','0','0'); -- id=1206
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1206;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-09', 3510, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3510, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3510, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3510, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '579', userid = '3', storedetaildate = '2026-10-09 15:56:40' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '9', '1', '346', 'اضافة فاتورة مبيعات', 'sellbillController.php', '588', '579', '3', '2026-10-09 15:56:40','0','0'); -- id=4138
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 778;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','01796', '346', '126', '1796', '9', '450', '4050', '0', '', '0', '2026-10-09 15:56:40', '1796', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','778-9,','1','1','0','0','450','4050','0','','0','0.00','0','0','0','0'); -- id=1207
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1207;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1796, '2026-10-09', 4050, 4050, 4050
                    , 4050, 3726, 3726, 3726
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3726, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3726
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3726
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4050, 4050, 4050
                    , 4050, 3726, 3726, 3726
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3726, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3726
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3726
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 15:56:40' WHERE storedetailid = '2809';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1796', '1', '9', '1', '346', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '18', '3', '2026-10-09 15:56:40','0','0'); -- id=4139
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 505;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('362.7','01659', '346', '125', '1659', '3', '390', '1170', '0', '', '0', '2026-10-09 15:56:40', '1659', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','505-3,','1','1','0','0','390','1170','0','','0','0.00','0','0','0','0'); -- id=1208
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 362.70, meanbuyprice_withDiscount = 362.70
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 362.7
                where sellbilldetailid = 1208;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1659, '2026-10-09', 1170, 1170, 1170
                    , 1170, 1088.1, 1088.1, 1088.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1088.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1088.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1088.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1170
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1170, 1170, 1170
                    , 1170, 1088.1, 1088.1, 1088.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1088.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1088.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1088.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1170
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '177', userid = '3', storedetaildate = '2026-10-09 15:56:40' WHERE storedetailid = '2671';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1659', '1', '3', '1', '346', 'اضافة فاتورة مبيعات', 'sellbillController.php', '180', '177', '3', '2026-10-09 15:56:40','0','0'); -- id=4140
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 503;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('334.8','01657', '346', '125', '1657', '9', '360', '3240', '0', '', '0', '2026-10-09 15:56:40', '1657', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','503-9,','1','1','0','0','360','3240','0','','0','0.00','0','0','0','0'); -- id=1209
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 334.80, meanbuyprice_withDiscount = 334.80
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 334.8
                where sellbilldetailid = 1209;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1657, '2026-10-09', 3240, 3240, 3240
                    , 3240, 3013.2, 3013.2, 3013.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3240, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3013.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3013.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3013.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3240, 3240, 3240
                    , 3240, 3013.2, 3013.2, 3013.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3240, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3013.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3013.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3013.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '132', userid = '3', storedetaildate = '2026-10-09 15:56:40' WHERE storedetailid = '2669';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1657', '1', '9', '1', '346', 'اضافة فاتورة مبيعات', 'sellbillController.php', '141', '132', '3', '2026-10-09 15:56:40','0','0'); -- id=4141
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 555;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','01691', '346', '126', '1691', '12', '450', '5400', '0', '', '0', '2026-10-09 15:56:40', '1691', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','555-12,','1','1','0','0','450','5400','0','','0','0.00','0','0','0','0'); -- id=1210
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1210;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1691, '2026-10-09', 5400, 5400, 5400
                    , 5400, 4968, 4968, 4968
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 5400, 5400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5400, sellCostBuyPrice =sellCostBuyPrice+5400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4968, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4968
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4968
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5400, 5400, 5400
                    , 5400, 4968, 4968, 4968
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5400, 5400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5400, sellCostBuyPrice =sellCostBuyPrice+5400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4968, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4968
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4968
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 15:56:40' WHERE storedetailid = '2703';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1691', '1', '12', '1', '346', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '3', '3', '2026-10-09 15:56:40','0','0'); -- id=4142
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 302;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('418.5','01524', '346', '111', '1524', '9', '465', '4185', '0', '', '0', '2026-10-09 15:56:40', '1524', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','302-9,','1','1','0','0','465','4185','0','','0','0.00','0','0','0','0'); -- id=1211
UPDATE sellbilldetail SET  lastbuyprice = 465.00 , meanbuyprice = 465.00, lastbuyprice_withDiscount = 418.50, meanbuyprice_withDiscount = 418.50
        , lastbuyprice_withTax = 465, meanbuyprice_withTax = 465, lastbuyprice_withDiscountAndTax = 418.5
                where sellbilldetailid = 1211;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1524, '2026-10-09', 4185, 4185, 4185
                    , 4185, 3766.5, 3766.5, 3766.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4185, 4185, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4185, sellCostBuyPrice =sellCostBuyPrice+4185
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3766.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3766.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3766.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4185
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4185
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4185, 4185, 4185
                    , 4185, 3766.5, 3766.5, 3766.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4185, 4185, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4185, sellCostBuyPrice =sellCostBuyPrice+4185
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3766.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3766.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3766.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4185
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4185
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '3', storedetaildate = '2026-10-09 15:56:40' WHERE storedetailid = '1549';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1524', '1', '9', '1', '346', 'اضافة فاتورة مبيعات', 'sellbillController.php', '25', '16', '3', '2026-10-09 15:56:40','0','0'); -- id=4143
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1986638',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1962683','23955', '0', '2', 'اضافة فاتورة مبيعات', '346', '1986638', '2026-10-09 15:56:40', '3',  'sellbillController.php','1','','0'); -- id=392
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '23955', '23955', '2026-10-09', '3', '0', '0', '2026-10-09 15:56:40','اضافة فاتورة مبيعات رقم 346','1','0',null,'0','346','sellbillController.php?do=showDetail&sellbillid=346'); -- id=1829
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1829', '419', '23955', '','0'); -- id=1860
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '1986635', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1829', '143', '23955', '','0'); -- id=1829
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3544145', 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 ( '21951.8', '21951.8', '2026-10-09', '3', '0', '0', '2026-10-09 15:56:40','اضافة فاتورة مبيعات رقم 346 - صرف البضاعة من المخزن','1','0',null,'0','346','sellbillController.php?do=showDetail&sellbillid=346'); -- id=1830
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1830', '402', '21951.8', '','0'); -- id=1861
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3334576.55', 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 ('1830', '382', '21951.8', '','0'); -- id=1830
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20111841.65', 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='1829,0,1830' where sellbillid=346;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 23955, 23435, 23435
                    , 23435, 21951.8, 21951.8, 21951.8
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,23435, 22315, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23955, sellCostBuyPrice =sellCostBuyPrice+23435
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+23435, sellCostMeanBuyPrice = sellCostMeanBuyPrice+23435
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+21951.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+21951.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+21951.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+23435
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22315
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 23955, 23435, 23435
                    , 23435, 21951.8, 21951.8, 21951.8
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,23435, 22315, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23955, sellCostBuyPrice =sellCostBuyPrice+23435
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+23435, sellCostMeanBuyPrice = sellCostMeanBuyPrice+23435
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+21951.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+21951.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+21951.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+23435
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22315
                        , returnSellVal = returnSellVal+0, 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, 23955, 23435, 23435
                    , 23435, 21951.8, 21951.8, 21951.8, 23435, 22315)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+23955, netSellCostBuyPrice = netSellCostBuyPrice+23435
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+23435
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+23435
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+21951.8
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+21951.8
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+21951.8
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+23435
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+22315;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8e1662c321 and sellbillId = 346 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:26:42";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:56:42", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:56:42', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6170
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:27:00";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:57:00", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:57:00', '4', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6171

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8e48289d8c
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-09 15:57:00', '06ac8e48289d8c', '1', '0.00', '0', '0', '1', '430', '430', '-430', '0', '2', '2026-10-09 15:57:00', '', '4', '0', 'نقدي','3', '0', '5', '0', 'نقدي', '1', '0', '', '','','','-1','0','0','0','','0','-430','0','0','0','0','0','0','0','0','-1','0','0','1','','0'); -- id=10
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','10', '0', '2026-10-09 15:57:00', '4', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '430', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 15:57:00','0','0','',''); -- id=455
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 ('370.00', '01550', '10', '112', '1550', '1', '430', '430', '0', '', '0', '0', '1550', '0.00', '-1','2','0','','','0','0','0','0','0','0','1','1','','0','0','430','430','0','','0'); -- id=17
UPDATE returnsellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 370.00, meanbuyprice_withDiscount = 370.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 370
                where returnsellbilldetailid = 17;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1550, '2026-10-09', 0, 0, 0
                    , 0, 0, 0, 0
                    , 430, 370, 370, 370
                    , 370, 370, 370, 0, 1, 0, 0, 370, 370)
                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+430, returnSellCostBuyPrice = returnSellCostBuyPrice+370, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+370
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+370, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+370
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+370
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+370
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+370
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+370
                        , 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 (2, '2026-10-09', 0, 0, 0
                    , 0, 0, 0, 0
                    , 430, 370, 370, 370
                    , 370, 370, 370, 0, 0, 370, 370)
                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+430, returnSellCostBuyPrice = returnSellCostBuyPrice+370, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+370
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+370, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+370
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+370
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+370
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+370
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+370;
UPDATE storedetail SET  productquantity = '147', userid = '4', storedetaildate = '2026-10-09 15:57:00' WHERE storedetailid = '2562';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1550', '2', '1', '0', '10', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '146', '147', '4', '2026-10-09 15:57:00','0','0'); -- id=4144
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '470230',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('470660','-430', '1', '3', 'اضافة فاتورة مردوات مبيعات', '10', '470230', '2026-10-09 15:57:00', '4',  'returnsellbillController.php','1','','0'); -- id=393
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '430', '430', '2026-10-09', '4', '0', '0', '2026-10-09 15:57:00','اضافة فاتورة مردود مبيعات رقم 10','1','0',null,'0','10','returnsellbillController.php?do=showDetail&returnsellbillid=10'); -- id=1831
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1831', '143', '430', '','0'); -- id=1862
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3543715', 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 ('1831', '501', '430', '','0'); -- id=1831
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '470230', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '370', '370', '2026-10-09', '4', '0', '0', '2026-10-09 15:57:00','اضافة فاتورة مردود مبيعات رقم 10 - صرف البضاعة من المخزن','1','0',null,'0','10','returnsellbillController.php?do=showDetail&returnsellbillid=10'); -- id=1832
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1832', '492', '370', '','0'); -- id=1863
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '722525', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1832', '402', '370', '','0'); -- id=1832
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3334206.55', 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='1831,0,1832' where returnsellbillid=10;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 0, 0, 0
                    , 0, 0, 0, 0
                    , 430, 370, 370, 370
                    , 370, 370, 370 ,0, 0, 370, 370)
                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+430, returnSellCostBuyPrice = returnSellCostBuyPrice+370, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+370
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+370, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+370
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+370
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+370
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+370
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+370;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 0, 0, 0
                    , 0, 0, 0, 0
                    , 430, 370, 370, 370
                    , 370, 370, 370 ,0, 0, 370, 370)
                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+430, returnSellCostBuyPrice = returnSellCostBuyPrice+370, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+370
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+370, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+370
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+370
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+370
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+370
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+370;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -430, -370, -370
                    , -370, -370, -370, -370, -370, -370)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-430, netSellCostBuyPrice = netSellCostBuyPrice+-370
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-370
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-370
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-370
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-370
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-370
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-370
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-370;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:27:01";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:57:01", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:57:01', '4', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=6172
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:27:23";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:57:23", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 15:57:23', '4', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6173
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:27:38";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:57:38", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:57:38', '4', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6174
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:28:19";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:58:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-09 15:58:19', '1', 'details', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=details&id=93'); -- id=6175
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:29:18";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:59:18", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:59:18', '3', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6176

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8dd923b612
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 15:59:18', '06ac8dd923b612', '1', '0.00', '0', '320', '1', '15750.00', '15430', '15430', '0', '1', '2026-10-09 15:59:18', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '39' ,'0','','','','','-1','0','0','0','0','0','15430','0','','0','0','15430','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=347
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','347', '0', '2026-10-09 15:59:18', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '15430', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 15:59:18','0','0','',''); -- id=456
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+18 where id = 776;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('404.8','01794', '347', '126', '1794', '18', '440', '7920', '0', '', '0', '2026-10-09 15:59:18', '1794', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','776-18,','1','1','0','0','440','7920','0','','0','0.00','0','0','0','0'); -- id=1212
UPDATE sellbilldetail SET  lastbuyprice = 440.00 , meanbuyprice = 440.00, lastbuyprice_withDiscount = 404.80, meanbuyprice_withDiscount = 404.80
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 404.8
                where sellbilldetailid = 1212;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1794, '2026-10-09', 7759.0857142857, 7920, 7920
                    , 7920, 7286.4, 7286.4, 7286.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 0, 7920, 7920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7759.0857142857, sellCostBuyPrice =sellCostBuyPrice+7920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7286.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7286.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7286.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+18
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 7759.0857142857, 7920, 7920
                    , 7920, 7286.4, 7286.4, 7286.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7920, 7920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7759.0857142857, sellCostBuyPrice =sellCostBuyPrice+7920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7286.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7286.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7286.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 15:59:18' WHERE storedetailid = '2807';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1794', '1', '18', '1', '347', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '3', '3', '2026-10-09 15:59:18','0','0'); -- id=4145
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 503;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('334.8','01657', '347', '125', '1657', '12', '360', '4320', '0', '', '0', '2026-10-09 15:59:18', '1657', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','503-12,','1','1','0','0','360','4320','0','','0','0.00','0','0','0','0'); -- id=1213
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 334.80, meanbuyprice_withDiscount = 334.80
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 334.8
                where sellbilldetailid = 1213;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1657, '2026-10-09', 4232.2285714286, 4320, 4320
                    , 4320, 4017.6, 4017.6, 4017.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4320, 4320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4232.2285714286, sellCostBuyPrice =sellCostBuyPrice+4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4017.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4017.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4017.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4232.2285714286, 4320, 4320
                    , 4320, 4017.6, 4017.6, 4017.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4320, 4320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4232.2285714286, sellCostBuyPrice =sellCostBuyPrice+4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4017.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4017.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4017.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 15:59:18' WHERE storedetailid = '2669';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1657', '1', '12', '1', '347', 'اضافة فاتورة مبيعات', 'sellbillController.php', '132', '120', '3', '2026-10-09 15:59:18','0','0'); -- id=4146
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 72;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01380', '347', '94', '1380', '9', '390', '3510', '0', '', '0', '2026-10-09 15:59:18', '1380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','72-9,','1','1','0','0','390','3510','0','','0','0.00','0','0','0','0'); -- id=1214
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1214;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-09', 3438.6857142857, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3438.6857142857, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3438.6857142857, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3438.6857142857, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '570', userid = '3', storedetaildate = '2026-10-09 15:59:18' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '9', '1', '347', 'اضافة فاتورة مبيعات', 'sellbillController.php', '579', '570', '3', '2026-10-09 15:59:18','0','0'); -- id=4147
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2002068',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1986638','15430', '0', '2', 'اضافة فاتورة مبيعات', '347', '2002068', '2026-10-09 15:59:18', '3',  'sellbillController.php','1','','0'); -- id=394
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '15750', '15750', '2026-10-09', '3', '0', '0', '2026-10-09 15:59:18','اضافة فاتورة مبيعات رقم 347','1','0',null,'0','347','sellbillController.php?do=showDetail&sellbillid=347'); -- id=1833
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1833', '419', '15430', '','0'); -- id=1864
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '2002065', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1833', '398', '320', '','0'); -- id=1865
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '137778', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1833', '143', '15750', '','0'); -- id=1833
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3559465', 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 ( '14454', '14454', '2026-10-09', '3', '0', '0', '2026-10-09 15:59:18','اضافة فاتورة مبيعات رقم 347 - صرف البضاعة من المخزن','1','0',null,'0','347','sellbillController.php?do=showDetail&sellbillid=347'); -- id=1834
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1834', '402', '14454', '','0'); -- id=1866
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3348660.55', 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 ('1834', '382', '14454', '','0'); -- id=1834
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20097387.65', 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='1833,0,1834' where sellbillid=347;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 15430, 15390, 15390
                    , 15390, 14454, 14454, 14454
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15390, 15390, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15430, sellCostBuyPrice =sellCostBuyPrice+15390
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15390, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15390
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14454, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14454
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14454
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15390
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15390
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 15430, 15390, 15390
                    , 15390, 14454, 14454, 14454
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15390, 15390, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15430, sellCostBuyPrice =sellCostBuyPrice+15390
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15390, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15390
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14454, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14454
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14454
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15390
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15390
                        , returnSellVal = returnSellVal+0, 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, 15430, 15390, 15390
                    , 15390, 14454, 14454, 14454, 15390, 15390)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+15430, netSellCostBuyPrice = netSellCostBuyPrice+15390
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+15390
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+15390
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+14454
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+14454
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+14454
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+15390
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+15390;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8dd923b612 and sellbillId = 347 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:29:18";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:59:18", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 15:59:18', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6177
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:29:24";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:59:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:59:24', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=6178
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:29:37";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 15:59:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 15:59:37', '1', 'editbill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=93'); -- id=6179
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:30:03";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:00:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 16:00:03', '1', 'update', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=update'); -- id=6180
BEGIN;
UPDATE costcenterdetail SET del = 1 WHERE type in( 3) and  modelid = 93;
UPDATE buybill SET  buybillsysdate = '2026-10-09 16:00:04', userid = '1',delbyuserid = '1', conditions = '1' WHERE buybillid = '93';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1647, 0, 0
                    , 480, 24, 0, 0, 1, '2026-10-09 16:00:04')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-24, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 16:00:04' ; -- id=768
UPDATE buybilldetail SET  lastbuyprice = 480.00 , meanbuyprice = 480.00, lastbuyprice_withDiscount = 480.00, meanbuyprice_withDiscount = 480.00
        , lastbuyprice_withTax = 480.00, meanbuyprice_withTax = 480.00, lastbuyprice_withDiscountAndTax = 480.00
                where buybilldetailid = 602;
UPDATE product SET productName = 'تطريز صدر ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '480.00', productSellHalfPrice = '480.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01647',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '0',meanbuyprice = '480.00',meanbuyprice_withDiscount = '480' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',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='480',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1647';
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 1647;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1672';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1647', '1', '24', '1', '93', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '24', '0', '1', '2026-10-09 14:12:14','0','0'); -- id=4148
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1648, 0, 0
                    , 480, 24, 0, 0, 1, '2026-10-09 16:00:04')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-24, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 16:00:04' ; -- id=769
UPDATE buybilldetail SET  lastbuyprice = 480.00 , meanbuyprice = 480.00, lastbuyprice_withDiscount = 480.00, meanbuyprice_withDiscount = 480.00
        , lastbuyprice_withTax = 480.00, meanbuyprice_withTax = 480.00, lastbuyprice_withDiscountAndTax = 480.00
                where buybilldetailid = 603;
UPDATE product SET productName = 'تطريز صدر و طباعه ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '480.00', productSellHalfPrice = '480.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01648',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '0',meanbuyprice = '480.00',meanbuyprice_withDiscount = '480' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',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='480',meanbuyprice_withTax='0',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='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1648';
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 1648;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1673';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1648', '1', '24', '1', '93', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '24', '0', '1', '2026-10-09 14:12:14','0','0'); -- id=4149
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1649, 0, 0
                    , 480, 24, 0, 0, 1, '2026-10-09 16:00:04')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-24, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 16:00:04' ; -- id=770
UPDATE buybilldetail SET  lastbuyprice = 480.00 , meanbuyprice = 480.00, lastbuyprice_withDiscount = 480.00, meanbuyprice_withDiscount = 480.00
        , lastbuyprice_withTax = 480.00, meanbuyprice_withTax = 480.00, lastbuyprice_withDiscountAndTax = 480.00
                where buybilldetailid = 604;
UPDATE product SET productName = 'تطريز صدر وضهر ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '480.00', productSellHalfPrice = '480.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01649',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '0',meanbuyprice = '480.00',meanbuyprice_withDiscount = '480' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',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='480',meanbuyprice_withTax='0',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='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1649';
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 1649;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1674';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1649', '1', '24', '1', '93', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '24', '0', '1', '2026-10-09 14:12:14','0','0'); -- id=4150
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1650, 0, 0
                    , 400, 24, 0, 0, 1, '2026-10-09 16:00:04')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-24, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 16:00:04' ; -- id=771
UPDATE buybilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 400.00, meanbuyprice_withDiscount = 400.00
        , lastbuyprice_withTax = 400.00, meanbuyprice_withTax = 400.00, lastbuyprice_withDiscountAndTax = 400.00
                where buybilldetailid = 605;
UPDATE product SET productName = 'طباعه ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '400.00', productSellAllPrice = '400.00', productSellUnitPrice = '400.00', productSellHalfPrice = '400.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01650',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '400',lastbuyprice_withDiscount = '0',meanbuyprice = '400.00',meanbuyprice_withDiscount = '400' , productbuypricereal = '400.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='400',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='400',meanbuyprice_withTax='0',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='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1650';
UPDATE productunit SET proUnitBuyPrice  = 400 * productnumber WHERE productid = 1650;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1675';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1650', '1', '24', '1', '93', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '24', '0', '1', '2026-10-09 14:12:14','0','0'); -- id=4151
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1651, 0, 0
                    , 410, 24, 0, 0, 1, '2026-10-09 16:00:04')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-24, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 16:00:04' ; -- id=772
UPDATE buybilldetail SET  lastbuyprice = 410.00 , meanbuyprice = 410.00, lastbuyprice_withDiscount = 410.00, meanbuyprice_withDiscount = 410.00
        , lastbuyprice_withTax = 410.00, meanbuyprice_withTax = 410.00, lastbuyprice_withDiscountAndTax = 410.00
                where buybilldetailid = 606;
UPDATE product SET productName = 'بوكس طباعه وسوسته ليزر2', productDescription = '', productCatId = '123', productBuyPrice = '410.00', productSellAllPrice = '410.00', productSellUnitPrice = '410.00', productSellHalfPrice = '410.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01651',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410',lastbuyprice_withDiscount = '0',meanbuyprice = '410.00',meanbuyprice_withDiscount = '410' , productbuypricereal = '410.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',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='410',meanbuyprice_withTax='0',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='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1651';
UPDATE productunit SET proUnitBuyPrice  = 410 * productnumber WHERE productid = 1651;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1676';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1651', '1', '24', '1', '93', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '24', '0', '1', '2026-10-09 14:12:14','0','0'); -- id=4152
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1652, 0, 0
                    , 350, 24, 0, 0, 1, '2026-10-09 16:00:04')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-24, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 16:00:04' ; -- id=773
UPDATE buybilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350.00, meanbuyprice_withTax = 350.00, lastbuyprice_withDiscountAndTax = 350.00
                where buybilldetailid = 607;
UPDATE product SET productName = 'حوض تطريز ليزر2', productDescription = '', productCatId = '123', productBuyPrice = '350.00', productSellAllPrice = '350.00', productSellUnitPrice = '350.00', productSellHalfPrice = '350.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01652',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '0',meanbuyprice = '350.00',meanbuyprice_withDiscount = '350' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',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='350',meanbuyprice_withTax='0',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='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1652';
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 1652;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1677';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1652', '1', '24', '1', '93', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '24', '0', '1', '2026-10-09 14:12:14','0','0'); -- id=4153
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1653, 0, 0
                    , 350, 24, 0, 0, 1, '2026-10-09 16:00:04')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-24, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 16:00:04' ; -- id=774
UPDATE buybilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350.00, meanbuyprice_withTax = 350.00, lastbuyprice_withDiscountAndTax = 350.00
                where buybilldetailid = 608;
UPDATE product SET productName = 'حوض تطريز صدر و ضهر ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '350.00', productSellAllPrice = '350.00', productSellUnitPrice = '350.00', productSellHalfPrice = '350.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01653',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '0',meanbuyprice = '350.00',meanbuyprice_withDiscount = '350' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',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='350',meanbuyprice_withTax='0',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='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1653';
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 1653;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1678';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1653', '1', '24', '1', '93', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '24', '0', '1', '2026-10-09 14:12:14','0','0'); -- id=4154
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1654, 0, 0
                    , 480, 24, 0, 0, 1, '2026-10-09 16:00:04')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-24, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 16:00:04' ; -- id=775
UPDATE buybilldetail SET  lastbuyprice = 480.00 , meanbuyprice = 480.00, lastbuyprice_withDiscount = 480.00, meanbuyprice_withDiscount = 480.00
        , lastbuyprice_withTax = 480.00, meanbuyprice_withTax = 480.00, lastbuyprice_withDiscountAndTax = 480.00
                where buybilldetailid = 609;
UPDATE product SET productName = 'بوكس 2 زنط ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '480.00', productSellHalfPrice = '480.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01654',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '0',meanbuyprice = '480.00',meanbuyprice_withDiscount = '480' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',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='480',meanbuyprice_withTax='0',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='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1654';
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 1654;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1679';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1654', '1', '24', '1', '93', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '24', '0', '1', '2026-10-09 14:12:14','0','0'); -- id=4155
UPDATE supplier SET  suppliercurrentDebt = '0',suppliercurrentDebtInCurrency= '0' , userid = '1', supplierdate = '2026-10-09 16:00:04'   WHERE supplierid = '119';
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 ('119', '82320.00', '82320.00', '1', 'حذف فاتورة مشتريات - للتعديل', '93', '0', '2026-10-09 14:12:14', '1', 'buyBillController.php', 'حذف فاتورة مشتريات - للتعديل', '0','', '0','1','1','82320','1','82320','82320','0','0',''); -- id=294
UPDATE productserial SET del = 1
		 WHERE billid = 93;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,deletedbuyid,controlname,payedtax,costcenterid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06ac8cc0e9769d', '2026-10-09 14:12:14', '119', '0.00', '74088', '10', '1', '82320.00', '74088.00', '0.00', '74088', '1', '2026-10-09 16:00:04', '', '1', '0', '', '1', '1','1','93','buyBillController.php','0.00','-1','1','0','0','.','0','0','0','0','0','0'); -- id=97
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 ('01647', '97', '123', '1647', '24.00', '480', '11520.00', '0.00', '', '2026-10-09 16:00:04', '1647','','','0','0','0','0','0',null,'480','11520','0','0','0','0','0','0','0','0','1'); -- id=626
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1647, 0, 0
                    , 432, 24, 0, 0, 1, '2026-10-09 16:00:04')
                ON DUPLICATE KEY UPDATE buyprice = 432,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 16:00:04' ; -- id=768
UPDATE product SET  productBuyPrice = "480" WHERE productId = 1647 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 626 ;
UPDATE product SET productName = 'تطريز صدر ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '480.00', productSellHalfPrice = '480.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01647',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '432',meanbuyprice = '480',meanbuyprice_withDiscount = '456' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',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='480',meanbuyprice_withTax='240',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='432',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1647';
UPDATE buybilldetail SET  lastbuyprice = 480 , meanbuyprice = 480, lastbuyprice_withDiscount = 432, meanbuyprice_withDiscount = 456
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 240, lastbuyprice_withDiscountAndTax = 432
                where buybilldetailid = 626;
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 1647;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1672';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1647', '1', '24', '0', '97', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:12:14','0','0'); -- id=4156
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 ('01648', '97', '123', '1648', '24.00', '480', '11520.00', '0.00', '', '2026-10-09 16:00:04', '1648','','','0','0','0','0','0',null,'480','11520','0','0','0','0','0','0','0','0','1'); -- id=627
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1648, 0, 0
                    , 432, 24, 0, 0, 1, '2026-10-09 16:00:04')
                ON DUPLICATE KEY UPDATE buyprice = 432,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 16:00:04' ; -- id=769
UPDATE product SET  productBuyPrice = "480" WHERE productId = 1648 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 627 ;
UPDATE product SET productName = 'تطريز صدر و طباعه ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '480.00', productSellHalfPrice = '480.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01648',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '432',meanbuyprice = '480',meanbuyprice_withDiscount = '456' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',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='480',meanbuyprice_withTax='240',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='432',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1648';
UPDATE buybilldetail SET  lastbuyprice = 480 , meanbuyprice = 480, lastbuyprice_withDiscount = 432, meanbuyprice_withDiscount = 456
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 240, lastbuyprice_withDiscountAndTax = 432
                where buybilldetailid = 627;
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 1648;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1673';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1648', '1', '24', '0', '97', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:12:14','0','0'); -- id=4157
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 ('01649', '97', '123', '1649', '24.00', '480', '11520.00', '0.00', '', '2026-10-09 16:00:04', '1649','','','0','0','0','0','0',null,'480','11520','0','0','0','0','0','0','0','0','1'); -- id=628
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1649, 0, 0
                    , 432, 24, 0, 0, 1, '2026-10-09 16:00:04')
                ON DUPLICATE KEY UPDATE buyprice = 432,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 16:00:04' ; -- id=770
UPDATE product SET  productBuyPrice = "480" WHERE productId = 1649 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 628 ;
UPDATE product SET productName = 'تطريز صدر وضهر ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '480.00', productSellHalfPrice = '480.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01649',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '432',meanbuyprice = '480',meanbuyprice_withDiscount = '456' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',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='480',meanbuyprice_withTax='240',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='432',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1649';
UPDATE buybilldetail SET  lastbuyprice = 480 , meanbuyprice = 480, lastbuyprice_withDiscount = 432, meanbuyprice_withDiscount = 456
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 240, lastbuyprice_withDiscountAndTax = 432
                where buybilldetailid = 628;
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 1649;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1674';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1649', '1', '24', '0', '97', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:12:14','0','0'); -- id=4158
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 ('01650', '97', '123', '1650', '24.00', '400', '9600.00', '0.00', '', '2026-10-09 16:00:04', '1650','','','0','0','0','0','0',null,'400','9600','0','0','0','0','0','0','0','0','1'); -- id=629
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1650, 0, 0
                    , 360, 24, 0, 0, 1, '2026-10-09 16:00:04')
                ON DUPLICATE KEY UPDATE buyprice = 360,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 16:00:04' ; -- id=771
UPDATE product SET  productBuyPrice = "400" WHERE productId = 1650 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 629 ;
UPDATE product SET productName = 'طباعه ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '400.00', productSellAllPrice = '400.00', productSellUnitPrice = '400.00', productSellHalfPrice = '400.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01650',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '400',lastbuyprice_withDiscount = '360',meanbuyprice = '400',meanbuyprice_withDiscount = '380' , productbuypricereal = '400.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='400',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='400',meanbuyprice_withTax='200',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='360',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1650';
UPDATE buybilldetail SET  lastbuyprice = 400 , meanbuyprice = 400, lastbuyprice_withDiscount = 360, meanbuyprice_withDiscount = 380
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 200, lastbuyprice_withDiscountAndTax = 360
                where buybilldetailid = 629;
UPDATE productunit SET proUnitBuyPrice  = 400 * productnumber WHERE productid = 1650;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1675';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1650', '1', '24', '0', '97', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:12:14','0','0'); -- id=4159
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 ('01651', '97', '123', '1651', '24.00', '410', '9840.00', '0.00', '', '2026-10-09 16:00:04', '1651','','','0','0','0','0','0',null,'410','9840','0','0','0','0','0','0','0','0','1'); -- id=630
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1651, 0, 0
                    , 369, 24, 0, 0, 1, '2026-10-09 16:00:04')
                ON DUPLICATE KEY UPDATE buyprice = 369,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 16:00:04' ; -- id=772
UPDATE product SET  productBuyPrice = "410" WHERE productId = 1651 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 630 ;
UPDATE product SET productName = 'بوكس طباعه وسوسته ليزر2', productDescription = '', productCatId = '123', productBuyPrice = '410.00', productSellAllPrice = '410.00', productSellUnitPrice = '410.00', productSellHalfPrice = '410.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01651',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410',lastbuyprice_withDiscount = '369',meanbuyprice = '410',meanbuyprice_withDiscount = '389.5' , productbuypricereal = '410.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',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='410',meanbuyprice_withTax='205',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='369',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1651';
UPDATE buybilldetail SET  lastbuyprice = 410 , meanbuyprice = 410, lastbuyprice_withDiscount = 369, meanbuyprice_withDiscount = 389.5
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 205, lastbuyprice_withDiscountAndTax = 369
                where buybilldetailid = 630;
UPDATE productunit SET proUnitBuyPrice  = 410 * productnumber WHERE productid = 1651;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1676';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1651', '1', '24', '0', '97', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:12:14','0','0'); -- id=4160
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 ('01652', '97', '123', '1652', '24.00', '350', '8400.00', '0.00', '', '2026-10-09 16:00:04', '1652','','','0','0','0','0','0',null,'350','8400','0','0','0','0','0','0','0','0','1'); -- id=631
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1652, 0, 0
                    , 315, 24, 0, 0, 1, '2026-10-09 16:00:04')
                ON DUPLICATE KEY UPDATE buyprice = 315,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 16:00:04' ; -- id=773
UPDATE product SET  productBuyPrice = "350" WHERE productId = 1652 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 631 ;
UPDATE product SET productName = 'حوض تطريز ليزر2', productDescription = '', productCatId = '123', productBuyPrice = '350.00', productSellAllPrice = '350.00', productSellUnitPrice = '350.00', productSellHalfPrice = '350.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01652',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '315',meanbuyprice = '350',meanbuyprice_withDiscount = '332.5' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',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='350',meanbuyprice_withTax='175',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='315',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1652';
UPDATE buybilldetail SET  lastbuyprice = 350 , meanbuyprice = 350, lastbuyprice_withDiscount = 315, meanbuyprice_withDiscount = 332.5
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 175, lastbuyprice_withDiscountAndTax = 315
                where buybilldetailid = 631;
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 1652;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1677';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1652', '1', '24', '0', '97', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:12:14','0','0'); -- id=4161
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 ('01653', '97', '123', '1653', '24.00', '350', '8400.00', '0.00', '', '2026-10-09 16:00:04', '1653','','','0','0','0','0','0',null,'350','8400','0','0','0','0','0','0','0','0','1'); -- id=632
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1653, 0, 0
                    , 315, 24, 0, 0, 1, '2026-10-09 16:00:04')
                ON DUPLICATE KEY UPDATE buyprice = 315,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 16:00:04' ; -- id=774
UPDATE product SET  productBuyPrice = "350" WHERE productId = 1653 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 632 ;
UPDATE product SET productName = 'حوض تطريز صدر و ضهر ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '350.00', productSellAllPrice = '350.00', productSellUnitPrice = '350.00', productSellHalfPrice = '350.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01653',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '315',meanbuyprice = '350',meanbuyprice_withDiscount = '332.5' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',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='350',meanbuyprice_withTax='175',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='315',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1653';
UPDATE buybilldetail SET  lastbuyprice = 350 , meanbuyprice = 350, lastbuyprice_withDiscount = 315, meanbuyprice_withDiscount = 332.5
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 175, lastbuyprice_withDiscountAndTax = 315
                where buybilldetailid = 632;
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 1653;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1678';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1653', '1', '24', '0', '97', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:12:14','0','0'); -- id=4162
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 ('01654', '97', '123', '1654', '24.00', '480', '11520.00', '0.00', '', '2026-10-09 16:00:04', '1654','','','0','0','0','0','0',null,'480','11520','0','0','0','0','0','0','0','0','1'); -- id=633
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 14:12:14', 1, 1654, 0, 0
                    , 432, 24, 0, 0, 1, '2026-10-09 16:00:04')
                ON DUPLICATE KEY UPDATE buyprice = 432,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 16:00:04' ; -- id=775
UPDATE product SET  productBuyPrice = "480" WHERE productId = 1654 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 633 ;
UPDATE product SET productName = 'بوكس 2 زنط ليزر 2', productDescription = '', productCatId = '123', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '480.00', productSellHalfPrice = '480.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01654',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '432',meanbuyprice = '480',meanbuyprice_withDiscount = '456' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',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='480',meanbuyprice_withTax='240',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='432',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1654';
UPDATE buybilldetail SET  lastbuyprice = 480 , meanbuyprice = 480, lastbuyprice_withDiscount = 432, meanbuyprice_withDiscount = 456
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 240, lastbuyprice_withDiscountAndTax = 432
                where buybilldetailid = 633;
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 1654;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1679';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1654', '1', '24', '0', '97', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 14:12:14','0','0'); -- id=4163
DELETE FROM productserial WHERE billid = 93
		and type =0 
		;
UPDATE supplier SET  suppliercurrentDebt = '74088',suppliercurrentDebtInCurrency= '74088' , userid = '1', supplierdate = '2026-10-09 16:00:04'   WHERE supplierid = '119';
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 ('119', '0.00', '74088', '0', 'اضافة فاتورة مشتريات', '97', '74088', '2026-10-09 16:00:04', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','82320','1','0','74088','74088','0',''); -- id=295
UPDATE dailyentry SET totalcreditor = '82320.00', totaldebtor = '82320.00', thedate = '2026-10-09', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 14:17:07', entryComment = 'اضافة فاتورة مشتريات رقم 93', fromFlag = '1',related='0',isopeningentry='0',operationId='93',operationDetailLink='buyBillController.php?do=details&id=93' WHERE id = '1782';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '82320.00', '82320.00', '2026-10-09', '1', '0', '1782', '2026-10-09 16:00:04','تم عكس القيد رقم 1782 ','1','0','-1','0','0',''); -- id=1835
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1835', '382', '82320.00', '','0'); -- id=1835
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20015067.65', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1835', '602', '82320.00', '','0'); -- id=1867
UPDATE accountstree SET name = 'ليزر 2', customName = 'ليزر 2', customNameEn = 'ليزر 2', nameEn = 'ليزر 2', parent = '81', accountNature = '1', theValue = '0', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 10:40:45' WHERE id = '602';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '74088', '74088', '2026-10-09', '1', '0', '0', '2026-10-09 16:00:04','اضافة فاتورة مشتريات رقم 97','1','0',null,'0','97','buyBillController.php?do=details&id=97'); -- id=1836
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1836', '382', '74088', '','0'); -- id=1868
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20089155.65', 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 ('1836', '602', '74088', '','0'); -- id=1836
UPDATE accountstree SET name = 'ليزر 2', customName = 'ليزر 2', customNameEn = 'ليزر 2', nameEn = 'ليزر 2', parent = '81', accountNature = '1', theValue = '74088', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 10:40:45' WHERE id = '602';
update buybill set dailyentryid='1836,0' where buybillid=97;
UPDATE product SET overAllAveragePrice = 432 WHERE productId = 1647;UPDATE product SET overAllAveragePrice = 432 WHERE productId = 1648;UPDATE product SET overAllAveragePrice = 432 WHERE productId = 1649;UPDATE product SET overAllAveragePrice = 360 WHERE productId = 1650;UPDATE product SET overAllAveragePrice = 369 WHERE productId = 1651;UPDATE product SET overAllAveragePrice = 315 WHERE productId = 1652;UPDATE product SET overAllAveragePrice = 315 WHERE productId = 1653;UPDATE product SET overAllAveragePrice = 432 WHERE productId = 1654;;
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:30:04";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:00:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 16:00:04', '1', 'editprint', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=97'); -- id=6181
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:30:14";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:00:14", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:00:14', '3', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6182

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8df530aae5
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 16:00:14', '06ac8df530aae5', '1', '0.00', '0', '0', '1', '19815.00', '19815', '19815', '0', '1', '2026-10-09 16:00:14', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '48' ,'0','','','','','-1','0','0','0','0','0','19815','0','','0','0','19815','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=348
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','348', '0', '2026-10-09 16:00:14', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '19815', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 16:00:14','0','0','',''); -- id=457
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 505;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('362.7','01659', '348', '125', '1659', '12', '390', '4680', '0', '', '0', '2026-10-09 16:00:14', '1659', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','505-12,','1','1','0','0','390','4680','0','','0','0.00','0','0','0','0'); -- id=1215
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 362.70, meanbuyprice_withDiscount = 362.70
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 362.7
                where sellbilldetailid = 1215;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1659, '2026-10-09', 4680, 4680, 4680
                    , 4680, 4352.4, 4352.4, 4352.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4680, 4680, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4680, sellCostBuyPrice =sellCostBuyPrice+4680
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4680, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4680
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4352.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4352.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4352.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4680
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4680
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4680, 4680, 4680
                    , 4680, 4352.4, 4352.4, 4352.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4680, 4680, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4680, sellCostBuyPrice =sellCostBuyPrice+4680
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4680, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4680
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4352.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4352.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4352.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4680
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4680
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '165', userid = '3', storedetaildate = '2026-10-09 16:00:14' WHERE storedetailid = '2671';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1659', '1', '12', '1', '348', 'اضافة فاتورة مبيعات', 'sellbillController.php', '177', '165', '3', '2026-10-09 16:00:14','0','0'); -- id=4164
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 503;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('334.8','01657', '348', '125', '1657', '12', '360', '4320', '0', '', '0', '2026-10-09 16:00:14', '1657', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','503-12,','1','1','0','0','360','4320','0','','0','0.00','0','0','0','0'); -- id=1216
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 334.80, meanbuyprice_withDiscount = 334.80
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 334.8
                where sellbilldetailid = 1216;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1657, '2026-10-09', 4320, 4320, 4320
                    , 4320, 4017.6, 4017.6, 4017.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4320, 4320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4320, sellCostBuyPrice =sellCostBuyPrice+4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4017.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4017.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4017.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4320, 4320, 4320
                    , 4320, 4017.6, 4017.6, 4017.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4320, 4320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4320, sellCostBuyPrice =sellCostBuyPrice+4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4017.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4017.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4017.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '108', userid = '3', storedetaildate = '2026-10-09 16:00:14' WHERE storedetailid = '2669';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1657', '1', '12', '1', '348', 'اضافة فاتورة مبيعات', 'sellbillController.php', '120', '108', '3', '2026-10-09 16:00:14','0','0'); -- id=4165
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 302;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('418.5','01524', '348', '111', '1524', '9', '465', '4185', '0', '', '0', '2026-10-09 16:00:14', '1524', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','302-9,','1','1','0','0','465','4185','0','','0','0.00','0','0','0','0'); -- id=1217
UPDATE sellbilldetail SET  lastbuyprice = 465.00 , meanbuyprice = 465.00, lastbuyprice_withDiscount = 418.50, meanbuyprice_withDiscount = 418.50
        , lastbuyprice_withTax = 465, meanbuyprice_withTax = 465, lastbuyprice_withDiscountAndTax = 418.5
                where sellbilldetailid = 1217;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1524, '2026-10-09', 4185, 4185, 4185
                    , 4185, 3766.5, 3766.5, 3766.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4185, 4185, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4185, sellCostBuyPrice =sellCostBuyPrice+4185
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3766.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3766.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3766.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4185
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4185
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4185, 4185, 4185
                    , 4185, 3766.5, 3766.5, 3766.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4185, 4185, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4185, sellCostBuyPrice =sellCostBuyPrice+4185
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3766.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3766.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3766.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4185
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4185
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 16:00:14' WHERE storedetailid = '1549';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1524', '1', '9', '1', '348', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16', '7', '3', '2026-10-09 16:00:14','0','0'); -- id=4166
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 778;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','01796', '348', '126', '1796', '9', '450', '4050', '0', '', '0', '2026-10-09 16:00:14', '1796', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','778-9,','1','1','0','0','450','4050','0','','0','0.00','0','0','0','0'); -- id=1218
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1218;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1796, '2026-10-09', 4050, 4050, 4050
                    , 4050, 3726, 3726, 3726
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3726, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3726
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3726
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4050, 4050, 4050
                    , 4050, 3726, 3726, 3726
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3726, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3726
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3726
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 16:00:14' WHERE storedetailid = '2809';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1796', '1', '9', '1', '348', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '9', '3', '2026-10-09 16:00:14','0','0'); -- id=4167
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 332;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('410','01462', '348', '103', '1462', '6', '430', '2580', '0', '', '0', '2026-10-09 16:00:14', '1462', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','332-6,','1','1','0','0','430','2580','0','','0','0.00','0','0','0','0'); -- id=1219
UPDATE sellbilldetail SET  lastbuyprice = 410.00 , meanbuyprice = 410.00, lastbuyprice_withDiscount = 410.00, meanbuyprice_withDiscount = 410.00
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 410, lastbuyprice_withDiscountAndTax = 410
                where sellbilldetailid = 1219;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1462, '2026-10-09', 2580, 2460, 2460
                    , 2460, 2460, 2460, 2460
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2460, 2460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2580, sellCostBuyPrice =sellCostBuyPrice+2460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2460
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2580, 2460, 2460
                    , 2460, 2460, 2460, 2460
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2460, 2460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2580, sellCostBuyPrice =sellCostBuyPrice+2460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2460
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '207', userid = '3', storedetaildate = '2026-10-09 16:00:14' WHERE storedetailid = '1487';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1462', '1', '6', '1', '348', 'اضافة فاتورة مبيعات', 'sellbillController.php', '213', '207', '3', '2026-10-09 16:00:14','0','0'); -- id=4168
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2021883',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('2002068','19815', '0', '2', 'اضافة فاتورة مبيعات', '348', '2021883', '2026-10-09 16:00:14', '3',  'sellbillController.php','1','','0'); -- id=395
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '19815', '19815', '2026-10-09', '3', '0', '0', '2026-10-09 16:00:14','اضافة فاتورة مبيعات رقم 348','1','0',null,'0','348','sellbillController.php?do=showDetail&sellbillid=348'); -- id=1837
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1837', '419', '19815', '','0'); -- id=1869
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '2021880', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1837', '143', '19815', '','0'); -- id=1837
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3579280', 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 ( '18322.5', '18322.5', '2026-10-09', '3', '0', '0', '2026-10-09 16:00:14','اضافة فاتورة مبيعات رقم 348 - صرف البضاعة من المخزن','1','0',null,'0','348','sellbillController.php?do=showDetail&sellbillid=348'); -- id=1838
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1838', '402', '18322.5', '','0'); -- id=1870
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3366983.05', 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 ('1838', '382', '18322.5', '','0'); -- id=1838
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20070833.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='1837,0,1838' where sellbillid=348;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 19815, 19695, 19695
                    , 19695, 18322.5, 18322.5, 18322.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,19695, 19695, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19815, sellCostBuyPrice =sellCostBuyPrice+19695
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19695, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19695
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18322.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18322.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18322.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19695
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19695
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 19815, 19695, 19695
                    , 19695, 18322.5, 18322.5, 18322.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,19695, 19695, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19815, sellCostBuyPrice =sellCostBuyPrice+19695
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19695, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19695
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18322.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18322.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18322.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19695
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19695
                        , returnSellVal = returnSellVal+0, 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, 19815, 19695, 19695
                    , 19695, 18322.5, 18322.5, 18322.5, 19695, 19695)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+19815, netSellCostBuyPrice = netSellCostBuyPrice+19695
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+19695
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+19695
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+18322.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+18322.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+18322.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+19695
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+19695;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:30:15";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:00:15", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:00:15', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6183
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:30:27";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:00:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-09 16:00:27', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php'); -- id=6184
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:30:28";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:00:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-09 16:00:28', '1', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=6185
UPDATE user SET loginip = "" WHERE userid = 2;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:32:56";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:02:56", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:02:56', '4', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6186

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8e4c27f610
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 16:02:56', '06ac8e4c27f610', '1', '0.00', '0', '0', '1', '2730.00', '2730', '2730', '0', '2', '2026-10-09 16:02:56', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '7' ,'0','','','','','-1','0','0','0','0','0','2730','0','','0','0','2730','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=349
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','349', '0', '2026-10-09 16:02:56', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2730', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 16:02:56','0','0','',''); -- id=458
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+7 where id = 131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01324', '349', '86', '1324', '7', '390', '2730', '0', '', '0', '2026-10-09 16:02:56', '1324', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','131-7,','1','1','0','0','390','2730','0','','0','0.00','0','0','0','0'); -- id=1220
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1220;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1324, '2026-10-09', 2730, 2450, 2450
                    , 2450, 2450, 2450, 2450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 2450, 2450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2730, sellCostBuyPrice =sellCostBuyPrice+2450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+7
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-09', 2730, 2450, 2450
                    , 2450, 2450, 2450, 2450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2450, 2450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2730, sellCostBuyPrice =sellCostBuyPrice+2450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '673', userid = '4', storedetaildate = '2026-10-09 16:02:56' WHERE storedetailid = '1405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '2', '7', '1', '349', 'اضافة فاتورة مبيعات', 'sellbillController.php', '680', '673', '4', '2026-10-09 16:02:56','0','0'); -- id=4169
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '472960',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('470230','2730', '0', '3', 'اضافة فاتورة مبيعات', '349', '472960', '2026-10-09 16:02:56', '4',  'sellbillController.php','1','','0'); -- id=396
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2730', '2730', '2026-10-09', '4', '0', '0', '2026-10-09 16:02:56','اضافة فاتورة مبيعات رقم 349','1','0',null,'0','349','sellbillController.php?do=showDetail&sellbillid=349'); -- id=1839
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1839', '501', '2730', '','0'); -- id=1871
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '472960', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1839', '143', '2730', '','0'); -- id=1839
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3582010', 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 ( '2450', '2450', '2026-10-09', '4', '0', '0', '2026-10-09 16:02:56','اضافة فاتورة مبيعات رقم 349 - صرف البضاعة من المخزن','1','0',null,'0','349','sellbillController.php?do=showDetail&sellbillid=349'); -- id=1840
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1840', '402', '2450', '','0'); -- id=1872
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3369433.05', 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 ('1840', '492', '2450', '','0'); -- id=1840
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '720075', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1839,0,1840' where sellbillid=349;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 2730, 2450, 2450
                    , 2450, 2450, 2450, 2450
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2450, 2450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2730, sellCostBuyPrice =sellCostBuyPrice+2450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2730, 2450, 2450
                    , 2450, 2450, 2450, 2450
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2450, 2450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2730, sellCostBuyPrice =sellCostBuyPrice+2450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2450
                        , returnSellVal = returnSellVal+0, 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, 2730, 2450, 2450
                    , 2450, 2450, 2450, 2450, 2450, 2450)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2730, netSellCostBuyPrice = netSellCostBuyPrice+2450
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2450
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2450
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2450
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2450
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2450
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2450
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2450;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8e4c27f610 and sellbillId = 349 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:32:56";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:02:56", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:02:56', '4', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6187
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:34:12";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:04:12", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:04:12', '4', 'addAndRetuen', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6188

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8e60092ed6
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 16:04:12', '06ac8e60092ed6', '1', '0.00', '0', '0', '1', '1650.00', '1650', '1650', '0', '2', '2026-10-09 16:04:12', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '3' ,'0','','','','','-1','0','0','0','0','0','1650','0','','0','0','1650','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=350
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','350', '0', '2026-10-09 16:04:12', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1650', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 16:04:12','0','0','',''); -- id=459
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 621;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('495','01722', '350', '49', '1722', '3', '550', '1650', '0', '', '0', '2026-10-09 16:04:12', '1722', '0.00', '0', '2','0.00','','','0','0','0','0','0','0','0','0','','621-3,','1','1','0','0','550','1650','0','','0','0.00','0','0','0','0'); -- id=1221
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 495.00, meanbuyprice_withDiscount = 495.00
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 495
                where sellbilldetailid = 1221;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1722, '2026-10-09', 1650, 1650, 1650
                    , 1650, 1485, 1485, 1485
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1485, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1485
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1485
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1650, 1650, 1650
                    , 1650, 1485, 1485, 1485
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1485, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1485
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1485
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '42', userid = '4', storedetaildate = '2026-10-09 16:04:12' WHERE storedetailid = '2735';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1722', '2', '3', '1', '350', 'اضافة فاتورة مبيعات', 'sellbillController.php', '45', '42', '4', '2026-10-09 16:04:12','0','0'); -- id=4170
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '474610',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('472960','1650', '0', '3', 'اضافة فاتورة مبيعات', '350', '474610', '2026-10-09 16:04:12', '4',  'sellbillController.php','1','','0'); -- id=397
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1650', '1650', '2026-10-09', '4', '0', '0', '2026-10-09 16:04:12','اضافة فاتورة مبيعات رقم 350','1','0',null,'0','350','sellbillController.php?do=showDetail&sellbillid=350'); -- id=1841
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1841', '501', '1650', '','0'); -- id=1873
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '474610', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1841', '143', '1650', '','0'); -- id=1841
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3583660', 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 ( '1485', '1485', '2026-10-09', '4', '0', '0', '2026-10-09 16:04:12','اضافة فاتورة مبيعات رقم 350 - صرف البضاعة من المخزن','1','0',null,'0','350','sellbillController.php?do=showDetail&sellbillid=350'); -- id=1842
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1842', '402', '1485', '','0'); -- id=1874
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3370918.05', 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 ('1842', '492', '1485', '','0'); -- id=1842
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '718590', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1841,0,1842' where sellbillid=350;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 1650, 1650, 1650
                    , 1650, 1485, 1485, 1485
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1485, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1485
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1485
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1650, 1650, 1650
                    , 1650, 1485, 1485, 1485
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1485, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1485
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1485
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, 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, 1650, 1650, 1650
                    , 1650, 1485, 1485, 1485, 1650, 1650)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1650, netSellCostBuyPrice = netSellCostBuyPrice+1650
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1650
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1650
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1485
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1485
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1485
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1650
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1650;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:34:13";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:04:13", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:04:13', '4', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6189
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:35:20";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:35:25";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:05:25", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 16:05:25', '2', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6190
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:35:25";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 16:05:25", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 16:05:25', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6191
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:35:26";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:05:26", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 16:05:26', '2', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6192
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:35:26";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 16:05:26", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 16:05:26', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6193
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:35:28";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:05:28", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:05:28', '2', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6194
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:35:33";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:05:33", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 16:05:33', '2', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6195
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:38:46";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:08:46", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 16:08:46', '3', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6196
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:38:46";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:08:46", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 16:08:46', '3', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6197
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:41:39";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:11:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsnewController.php', '2026-10-09 16:11:39', '1', '', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsnewController.php'); -- id=6198
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:43:59";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:13:59", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:13:59', '2', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6199
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:45:06";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:15:06", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientController.php', '2026-10-09 16:15:06', '3', 'show', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientController.php?do=show'); -- id=6200
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:45:54";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:15:54", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:15:54', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6201
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 12:45:54";
UPDATE user SET loginip = "156.196.85.230", lastactivetime = "2026-10-09 16:15:54", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:15:54', '3', 'addsellBill', '156.196.85.230', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6202
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:00:17";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:00:28";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:30:28", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 16:30:28', '4', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6203
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:00:28";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 16:30:28", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 16:30:28', '4', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6204
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:00:30";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:30:30", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:30:30', '4', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6205
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:03:13";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:03:35";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:33:35", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 16:33:35', '4', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6206
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:03:36";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 16:33:36", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 16:33:36', '4', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6207
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:03:41";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:33:41", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:33:41', '4', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6208
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:03:44";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:33:44", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 16:33:44', '4', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6209
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:03:50";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:33:50", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:33:50', '4', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6210
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:04:01";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:04:01";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:04:03";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:34:03", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:34:03', '4', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6211

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8ed3e9be8d
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 16:34:03', '06ac8ed3e9be8d', '1', '0.00', '0', '0', '1', '1520.00', '1520', '1520', '0', '2', '2026-10-09 16:34:03', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '4' ,'0','','','','','-1','0','0','0','0','0','1520','0','','0','0','1520','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=351
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','351', '0', '2026-10-09 16:34:03', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1520', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 16:34:03','0','0','',''); -- id=460
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 495;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01551', '351', '112', '1551', '4', '380', '1520', '0', '', '0', '2026-10-09 16:34:03', '1551', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','495-4,','1','1','0','0','380','1520','0','','0','0.00','0','0','0','0'); -- id=1222
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 1222;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1551, '2026-10-09', 1520, 1280, 1280
                    , 1280, 1280, 1280, 1280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1280, 1280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1520, sellCostBuyPrice =sellCostBuyPrice+1280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1520, 1280, 1280
                    , 1280, 1280, 1280, 1280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1280, 1280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1520, sellCostBuyPrice =sellCostBuyPrice+1280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '460', userid = '4', storedetaildate = '2026-10-09 16:34:03' WHERE storedetailid = '2563';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1551', '2', '4', '1', '351', 'اضافة فاتورة مبيعات', 'sellbillController.php', '464', '460', '4', '2026-10-09 16:34:03','0','0'); -- id=4171
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '476130',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('474610','1520', '0', '3', 'اضافة فاتورة مبيعات', '351', '476130', '2026-10-09 16:34:03', '4',  'sellbillController.php','1','','0'); -- id=398
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1520', '1520', '2026-10-09', '4', '0', '0', '2026-10-09 16:34:03','اضافة فاتورة مبيعات رقم 351','1','0',null,'0','351','sellbillController.php?do=showDetail&sellbillid=351'); -- id=1843
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1843', '501', '1520', '','0'); -- id=1875
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '476130', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1843', '143', '1520', '','0'); -- id=1843
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3585180', 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 ( '1280', '1280', '2026-10-09', '4', '0', '0', '2026-10-09 16:34:03','اضافة فاتورة مبيعات رقم 351 - صرف البضاعة من المخزن','1','0',null,'0','351','sellbillController.php?do=showDetail&sellbillid=351'); -- id=1844
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1844', '402', '1280', '','0'); -- id=1876
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3372198.05', 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 ('1844', '492', '1280', '','0'); -- id=1844
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '717310', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1843,0,1844' where sellbillid=351;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 1520, 1280, 1280
                    , 1280, 1280, 1280, 1280
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1280, 1280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1520, sellCostBuyPrice =sellCostBuyPrice+1280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1520, 1280, 1280
                    , 1280, 1280, 1280, 1280
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1280, 1280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1520, sellCostBuyPrice =sellCostBuyPrice+1280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1280
                        , returnSellVal = returnSellVal+0, 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, 1520, 1280, 1280
                    , 1280, 1280, 1280, 1280, 1280, 1280)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1520, netSellCostBuyPrice = netSellCostBuyPrice+1280
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1280
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1280
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1280
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1280
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1280
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1280
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1280;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:04:04";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:34:04", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:34:04', '4', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6212
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:04:07";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:34:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 16:34:07', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6213
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:04:07";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 16:34:07', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6214
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:05:31";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:35:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-09 16:35:31', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=6215
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:05:33";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:35:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 16:35:33', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=6216
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:05:55";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:35:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 16:35:55', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=6217
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:06:35";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:36:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 16:36:35', '1', 'showbarcode', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=6218
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:07:31";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:37:31", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 16:37:31', '4', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6219
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:07:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:37:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 16:37:34', '1', 'showbarcode', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=6220
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:07:37";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:37:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 16:37:37', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=6221
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:09:44";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:39:44", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:39:44', '4', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6222
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:22:21";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:52:21", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:52:21', '2', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6223

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8e8979467f
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 16:52:21', '06ac8e8979467f', '1', '0.00', '0', '0', '1', '3200.00', '3200', '3200', '0', '1', '2026-10-09 16:52:21', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '10' ,'0','','','','','-1','0','0','0','0','0','3200','0','','0','0','3200','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=352
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','352', '0', '2026-10-09 16:52:21', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3200', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 16:52:21','0','0','',''); -- id=461
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 656;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','01743', '352', '134', '1743', '4', '320', '1280', '0', '', '0', '2026-10-09 16:52:21', '1743', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','656-4,','1','1','0','0','320','1280','0','','0','0.00','0','0','0','0'); -- id=1223
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 1223;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1743, '2026-10-09', 1280, 1200, 1200
                    , 1200, 1200, 1200, 1200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1280, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1280, 1200, 1200
                    , 1200, 1200, 1200, 1200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1280, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 16:52:21' WHERE storedetailid = '2756';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1743', '1', '4', '1', '352', 'اضافة فاتورة مبيعات', 'sellbillController.php', '40', '36', '2', '2026-10-09 16:52:21','0','0'); -- id=4172
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 542;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('288','01640', '352', '122', '1640', '6', '320', '1920', '0', '', '0', '2026-10-09 16:52:21', '1640', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','542-6,','1','1','0','0','320','1920','0','','0','0.00','0','0','0','0'); -- id=1224
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 288.00, meanbuyprice_withDiscount = 288.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 288
                where sellbilldetailid = 1224;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1640, '2026-10-09', 1920, 1920, 1920
                    , 1920, 1728, 1728, 1728
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1920, 1920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1920, sellCostBuyPrice =sellCostBuyPrice+1920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1728, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1728
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1728
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1920, 1920, 1920
                    , 1920, 1728, 1728, 1728
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1920, 1920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1920, sellCostBuyPrice =sellCostBuyPrice+1920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1728, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1728
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1728
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 16:52:21' WHERE storedetailid = '1665';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1640', '1', '6', '1', '352', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '9', '2', '2026-10-09 16:52:21','0','0'); -- id=4173
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2025083',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('2021883','3200', '0', '2', 'اضافة فاتورة مبيعات', '352', '2025083', '2026-10-09 16:52:21', '2',  'sellbillController.php','1','','0'); -- id=399
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3200', '3200', '2026-10-09', '2', '0', '0', '2026-10-09 16:52:21','اضافة فاتورة مبيعات رقم 352','1','0',null,'0','352','sellbillController.php?do=showDetail&sellbillid=352'); -- id=1845
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1845', '419', '3200', '','0'); -- id=1877
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '2025080', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1845', '143', '3200', '','0'); -- id=1845
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3588380', 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 ( '2928', '2928', '2026-10-09', '2', '0', '0', '2026-10-09 16:52:21','اضافة فاتورة مبيعات رقم 352 - صرف البضاعة من المخزن','1','0',null,'0','352','sellbillController.php?do=showDetail&sellbillid=352'); -- id=1846
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1846', '402', '2928', '','0'); -- id=1878
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3375126.05', 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 ('1846', '382', '2928', '','0'); -- id=1846
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20067905.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='1845,0,1846' where sellbillid=352;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 3200, 3120, 3120
                    , 3120, 2928, 2928, 2928
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3200, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2928, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2928
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2928
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3200, 3120, 3120
                    , 3120, 2928, 2928, 2928
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3200, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2928, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2928
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2928
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, 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, 3200, 3120, 3120
                    , 3120, 2928, 2928, 2928, 3120, 3120)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3200, netSellCostBuyPrice = netSellCostBuyPrice+3120
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3120
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3120
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2928
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2928
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2928
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3120
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3120;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:22:22";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:52:22", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:52:22', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6224
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:24:46";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:54:46", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:54:46', '2', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6225

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8f1962489e
-- ----------------------------------------------------------------------------------------------------

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

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:24:46";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:54:46", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:54:46', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6226
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:27:26";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:57:26", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 16:57:26', '6', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6227
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:27:26";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:57:26", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 16:57:26', '6', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6228
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:27:32";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:57:32", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:57:32', '6', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6229
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:29:38";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:59:38", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:59:38', '6', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6230

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8f2cc79404
-- ----------------------------------------------------------------------------------------------------

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

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:29:38";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 16:59:38", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 16:59:38', '6', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6231
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:32:55";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:02:55", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 17:02:55', '3', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6232

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8e90b02efe
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 17:02:55', '06ac8e90b02efe', '1', '0.00', '0', '0', '1', '5930.00', '5930', '5930', '0', '1', '2026-10-09 17:02:55', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '19' ,'0','','','','','-1','0','0','0','0','0','5930','0','','0','0','5930','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=355
UPDATE client SET  clientdebt = '0', userid = '3' 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','اضافة فاتورة مبيعات','355', '0', '2026-10-09 17:02:55', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '5930', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 17:02:55','0','0','',''); -- id=464
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 199;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('180','01450', '355', '101', '1450', '3', '200', '600', '0', '', '0', '2026-10-09 17:02:55', '1450', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','199-3,','1','1','0','0','200','600','0','','0','0.00','0','0','0','0'); -- id=1227
UPDATE sellbilldetail SET  lastbuyprice = 200.00 , meanbuyprice = 200.00, lastbuyprice_withDiscount = 180.00, meanbuyprice_withDiscount = 180.00
        , lastbuyprice_withTax = 200, meanbuyprice_withTax = 200, lastbuyprice_withDiscountAndTax = 180
                where sellbilldetailid = 1227;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1450, '2026-10-09', 600, 600, 600
                    , 600, 540, 540, 540
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+540, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+540
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+540
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 600, 600, 600
                    , 600, 540, 540, 540
                    , 0, 0, 0, 0
                    , 0, 0, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+540, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+540
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+540
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 17:02:55' WHERE storedetailid = '1467';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1450', '1', '3', '1', '355', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '9', '3', '2026-10-09 17:02:55','0','0'); -- id=4176
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 200;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('207','01451', '355', '101', '1451', '3', '230', '690', '0', '', '0', '2026-10-09 17:02:55', '1451', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','200-3,','1','1','0','0','230','690','0','','0','0.00','0','0','0','0'); -- id=1228
UPDATE sellbilldetail SET  lastbuyprice = 230.00 , meanbuyprice = 230.00, lastbuyprice_withDiscount = 207.00, meanbuyprice_withDiscount = 207.00
        , lastbuyprice_withTax = 230, meanbuyprice_withTax = 230, lastbuyprice_withDiscountAndTax = 207
                where sellbilldetailid = 1228;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1451, '2026-10-09', 690, 690, 690
                    , 690, 621, 621, 621
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 690, 690, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+690, sellCostBuyPrice =sellCostBuyPrice+690
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+690, sellCostMeanBuyPrice = sellCostMeanBuyPrice+690
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+621, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+621
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+621
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+690
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+690
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 690, 690, 690
                    , 690, 621, 621, 621
                    , 0, 0, 0, 0
                    , 0, 0, 0, 690, 690, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+690, sellCostBuyPrice =sellCostBuyPrice+690
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+690, sellCostMeanBuyPrice = sellCostMeanBuyPrice+690
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+621, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+621
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+621
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+690
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+690
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 17:02:55' WHERE storedetailid = '1468';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1451', '1', '3', '1', '355', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '18', '3', '2026-10-09 17:02:55','0','0'); -- id=4177
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 442;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('377.2','01590', '355', '116', '1590', '4', '410', '1640', '0', '', '0', '2026-10-09 17:02:55', '1590', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','442-4,','1','1','0','0','410','1640','0','','0','0.00','0','0','0','0'); -- id=1229
UPDATE sellbilldetail SET  lastbuyprice = 410.00 , meanbuyprice = 410.00, lastbuyprice_withDiscount = 377.20, meanbuyprice_withDiscount = 377.20
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 410, lastbuyprice_withDiscountAndTax = 377.2
                where sellbilldetailid = 1229;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1590, '2026-10-09', 1640, 1640, 1640
                    , 1640, 1508.8, 1508.8, 1508.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1640, 1640, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1640, sellCostBuyPrice =sellCostBuyPrice+1640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1508.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1508.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1508.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1640
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1640, 1640, 1640
                    , 1640, 1508.8, 1508.8, 1508.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1640, 1640, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1640, sellCostBuyPrice =sellCostBuyPrice+1640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1508.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1508.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1508.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1640
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '32', userid = '3', storedetaildate = '2026-10-09 17:02:55' WHERE storedetailid = '1615';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1590', '1', '4', '1', '355', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '32', '3', '2026-10-09 17:02:55','0','0'); -- id=4178
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','01379', '355', '94', '1379', '6', '300', '1800', '0', '', '0', '2026-10-09 17:02:55', '1379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','71-6,','1','1','0','0','300','1800','0','','0','0.00','0','0','0','0'); -- id=1230
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1230;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-09', 1800, 1620, 1620
                    , 1620, 1620, 1620, 1620
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1620, 1620, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1800, sellCostBuyPrice =sellCostBuyPrice+1620
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1620, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1620
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1620, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1620
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1620
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1620
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1620
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1800, 1620, 1620
                    , 1620, 1620, 1620, 1620
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1620, 1620, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1800, sellCostBuyPrice =sellCostBuyPrice+1620
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1620, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1620
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1620, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1620
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1620
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1620
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1620
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 17:02:55' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '6', '1', '355', 'اضافة فاتورة مبيعات', 'sellbillController.php', '627', '621', '3', '2026-10-09 17:02:55','0','0'); -- id=4179
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 74;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','01382', '355', '94', '1382', '3', '400', '1200', '0', '', '0', '2026-10-09 17:02:55', '1382', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','74-3,','1','1','0','0','400','1200','0','','0','0.00','0','0','0','0'); -- id=1231
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1231;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1382, '2026-10-09', 1200, 1080, 1080
                    , 1080, 1080, 1080, 1080
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1200, 1080, 1080
                    , 1080, 1080, 1080, 1080
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '54', userid = '3', storedetaildate = '2026-10-09 17:02:55' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '3', '1', '355', 'اضافة فاتورة مبيعات', 'sellbillController.php', '57', '54', '3', '2026-10-09 17:02:55','0','0'); -- id=4180
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2032933',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('2027003','5930', '0', '2', 'اضافة فاتورة مبيعات', '355', '2032933', '2026-10-09 17:02:55', '3',  'sellbillController.php','1','','0'); -- id=402
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5930', '5930', '2026-10-09', '3', '0', '0', '2026-10-09 17:02:55','اضافة فاتورة مبيعات رقم 355','1','0',null,'0','355','sellbillController.php?do=showDetail&sellbillid=355'); -- id=1851
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1851', '419', '5930', '','0'); -- id=1883
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '2032930', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1851', '143', '5930', '','0'); -- id=1851
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3598210', 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 ( '5369.8', '5369.8', '2026-10-09', '3', '0', '0', '2026-10-09 17:02:55','اضافة فاتورة مبيعات رقم 355 - صرف البضاعة من المخزن','1','0',null,'0','355','sellbillController.php?do=showDetail&sellbillid=355'); -- id=1852
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1852', '402', '5369.8', '','0'); -- id=1884
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3383903.85', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1852', '382', '5369.8', '','0'); -- id=1852
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20059127.35', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1851,0,1852' where sellbillid=355;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 5930, 5630, 5630
                    , 5630, 5369.8, 5369.8, 5369.8
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5630, 5630, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5930, sellCostBuyPrice =sellCostBuyPrice+5630
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5630, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5630
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5369.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5369.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5369.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5630
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5630
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5930, 5630, 5630
                    , 5630, 5369.8, 5369.8, 5369.8
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5630, 5630, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5930, sellCostBuyPrice =sellCostBuyPrice+5630
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5630, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5630
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5369.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5369.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5369.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5630
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5630
                        , returnSellVal = returnSellVal+0, 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, 5930, 5630, 5630
                    , 5630, 5369.8, 5369.8, 5369.8, 5630, 5630)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5930, netSellCostBuyPrice = netSellCostBuyPrice+5630
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5630
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5630
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5369.8
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5369.8
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5369.8
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5630
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5630;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8e90b02efe and sellbillId = 355 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:32:55";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:02:55", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 17:02:55', '3', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6233
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:36:01";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:06:01", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 17:06:01', '4', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6234

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8eea016e89
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 17:06:01', '06ac8eea016e89', '1', '0.00', '0', '0', '1', '6080.00', '6080', '6080', '0', '2', '2026-10-09 17:06:01', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '16' ,'0','','','','','-1','0','0','0','0','0','6080','0','','0','0','6080','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=356
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','356', '0', '2026-10-09 17:06:01', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '6080', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 17:06:01','0','0','',''); -- id=465
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+16 where id = 495;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01551', '356', '112', '1551', '16', '380', '6080', '0', '', '0', '2026-10-09 17:06:01', '1551', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','495-16,','1','1','0','0','380','6080','0','','0','0.00','0','0','0','0'); -- id=1232
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 1232;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1551, '2026-10-09', 6080, 5120, 5120
                    , 5120, 5120, 5120, 5120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 5120, 5120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6080, sellCostBuyPrice =sellCostBuyPrice+5120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-09', 6080, 5120, 5120
                    , 5120, 5120, 5120, 5120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5120, 5120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6080, sellCostBuyPrice =sellCostBuyPrice+5120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '444', userid = '4', storedetaildate = '2026-10-09 17:06:01' WHERE storedetailid = '2563';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1551', '2', '16', '1', '356', 'اضافة فاتورة مبيعات', 'sellbillController.php', '460', '444', '4', '2026-10-09 17:06:01','0','0'); -- id=4181
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '482210',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('476130','6080', '0', '3', 'اضافة فاتورة مبيعات', '356', '482210', '2026-10-09 17:06:01', '4',  'sellbillController.php','1','','0'); -- id=403
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6080', '6080', '2026-10-09', '4', '0', '0', '2026-10-09 17:06:01','اضافة فاتورة مبيعات رقم 356','1','0',null,'0','356','sellbillController.php?do=showDetail&sellbillid=356'); -- id=1853
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1853', '501', '6080', '','0'); -- id=1885
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '482210', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1853', '143', '6080', '','0'); -- id=1853
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3604290', 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 ( '5120', '5120', '2026-10-09', '4', '0', '0', '2026-10-09 17:06:01','اضافة فاتورة مبيعات رقم 356 - صرف البضاعة من المخزن','1','0',null,'0','356','sellbillController.php?do=showDetail&sellbillid=356'); -- id=1854
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1854', '402', '5120', '','0'); -- id=1886
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3389023.85', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1854', '492', '5120', '','0'); -- id=1854
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '712190', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1853,0,1854' where sellbillid=356;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 6080, 5120, 5120
                    , 5120, 5120, 5120, 5120
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5120, 5120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6080, sellCostBuyPrice =sellCostBuyPrice+5120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 6080, 5120, 5120
                    , 5120, 5120, 5120, 5120
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5120, 5120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6080, sellCostBuyPrice =sellCostBuyPrice+5120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5120
                        , returnSellVal = returnSellVal+0, 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, 6080, 5120, 5120
                    , 5120, 5120, 5120, 5120, 5120, 5120)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6080, netSellCostBuyPrice = netSellCostBuyPrice+5120
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5120
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5120
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5120
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5120
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5120
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5120
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5120;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8eea016e89 and sellbillId = 356 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 13:36:01";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:06:01", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 17:06:01', '4', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6235
UPDATE user SET loginip = "" WHERE userid = 6;
UPDATE user SET loginip = "" WHERE userid = 3;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:03:14";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:33:14", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 17:33:14', '2', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6236

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8f22650ccd
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 17:33:14', '06ac8f22650ccd', '1', '0.00', '0', '0', '1', '8640.00', '8640', '8640', '0', '1', '2026-10-09 17:33:14', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '26' ,'0','','','','','-1','0','0','0','0','0','8640','0','','0','0','8640','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=357
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','357', '0', '2026-10-09 17:33:14', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '8640', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 17:33:14','0','0','',''); -- id=466
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+16 where id = 355;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('276','01467', '357', '104', '1467', '16', '340', '5440', '0', '', '0', '2026-10-09 17:33:14', '1467', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','355-16,','1','1','0','0','340','5440','0','','0','0.00','0','0','0','0'); -- id=1233
UPDATE sellbilldetail SET  lastbuyprice = 276.00 , meanbuyprice = 276.00, lastbuyprice_withDiscount = 276.00, meanbuyprice_withDiscount = 276.00
        , lastbuyprice_withTax = 276, meanbuyprice_withTax = 276, lastbuyprice_withDiscountAndTax = 276
                where sellbilldetailid = 1233;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1467, '2026-10-09', 5440, 4416, 4416
                    , 4416, 4416, 4416, 4416
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 4416, 4416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5440, sellCostBuyPrice =sellCostBuyPrice+4416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4416, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4416
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5440, 4416, 4416
                    , 4416, 4416, 4416, 4416
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4416, 4416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5440, sellCostBuyPrice =sellCostBuyPrice+4416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4416, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4416
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '668', userid = '2', storedetaildate = '2026-10-09 17:33:14' WHERE storedetailid = '1492';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1467', '1', '16', '1', '357', 'اضافة فاتورة مبيعات', 'sellbillController.php', '684', '668', '2', '2026-10-09 17:33:14','0','0'); -- id=4182
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','08583', '357', '13', '773', '10', '320', '3200', '0', '', '0', '2026-10-09 17:33:14', '773', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','320','3200','0','','0','0.00','0','0','0','0'); -- id=1234
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 1234;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (773, '2026-10-09', 3200, 3000, 3000
                    , 3000, 3000, 3000, 3000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 3000, 3000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3200, sellCostBuyPrice =sellCostBuyPrice+3000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3200, 3000, 3000
                    , 3000, 3000, 3000, 3000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3000, 3000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3200, sellCostBuyPrice =sellCostBuyPrice+3000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '26', userid = '2', storedetaildate = '2026-10-09 17:33:14' WHERE storedetailid = '773';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('773', '1', '10', '1', '357', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '26', '2', '2026-10-09 17:33:14','0','0'); -- id=4183
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2041573',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('2032933','8640', '0', '2', 'اضافة فاتورة مبيعات', '357', '2041573', '2026-10-09 17:33:14', '2',  'sellbillController.php','1','','0'); -- id=404
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '8640', '8640', '2026-10-09', '2', '0', '0', '2026-10-09 17:33:14','اضافة فاتورة مبيعات رقم 357','1','0',null,'0','357','sellbillController.php?do=showDetail&sellbillid=357'); -- id=1855
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1855', '419', '8640', '','0'); -- id=1887
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '2041570', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1855', '143', '8640', '','0'); -- id=1855
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3612930', 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 ( '7416', '7416', '2026-10-09', '2', '0', '0', '2026-10-09 17:33:14','اضافة فاتورة مبيعات رقم 357 - صرف البضاعة من المخزن','1','0',null,'0','357','sellbillController.php?do=showDetail&sellbillid=357'); -- id=1856
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1856', '402', '7416', '','0'); -- id=1888
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3396439.85', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1856', '382', '7416', '','0'); -- id=1856
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20051711.35', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1855,0,1856' where sellbillid=357;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 8640, 7416, 7416
                    , 7416, 7416, 7416, 7416
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7416, 7416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8640, sellCostBuyPrice =sellCostBuyPrice+7416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7416, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7416
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 8640, 7416, 7416
                    , 7416, 7416, 7416, 7416
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7416, 7416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8640, sellCostBuyPrice =sellCostBuyPrice+7416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7416, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7416
                        , returnSellVal = returnSellVal+0, 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, 8640, 7416, 7416
                    , 7416, 7416, 7416, 7416, 7416, 7416)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+8640, netSellCostBuyPrice = netSellCostBuyPrice+7416
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+7416
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+7416
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+7416
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+7416
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+7416
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+7416
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+7416;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:03:14";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:33:14", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 17:33:14', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6237
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:04:37";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:34:37", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 17:34:37', '2', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6238

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8fb2ad4411
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac8fb2ad4411 and sellbillId = 358 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:04:38";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:34:38", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 17:34:38', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6239
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:08:32";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:08:59";
UPDATE user SET loginip = "196.157.70.183", lastactivetime = "2026-10-09 17:38:59", deviceType = "MOBILE" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 17:38:59', '3', '', '196.157.70.183', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6240
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:09:00";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 17:39:00', '3', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6241
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:09:29";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:39:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 17:39:29', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=6242
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:09:30";
UPDATE user SET loginip = "196.157.70.183", lastactivetime = "2026-10-09 17:39:30", deviceType = "MOBILE" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 17:39:30', '3', 'addsellBill', '196.157.70.183', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6243
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:09:52";
UPDATE user SET loginip = "196.157.70.183", lastactivetime = "2026-10-09 17:39:52", deviceType = "MOBILE" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 17:39:52', '3', 'addsellBill', '196.157.70.183', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6244
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:09:54";
UPDATE user SET loginip = "196.157.70.183", lastactivetime = "2026-10-09 17:39:54", deviceType = "MOBILE" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 17:39:54', '3', '', '196.157.70.183', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6245
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:09:54";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 17:39:54', '3', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6246
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:09:55";
UPDATE user SET loginip = "196.157.70.183", lastactivetime = "2026-10-09 17:39:55", deviceType = "MOBILE" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 17:39:55', '3', '', '196.157.70.183', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6247
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:09:55";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 17:39:55', '3', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6248
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:10:12";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:40:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 17:40:13', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6249
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:10:13";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 17:40:13', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6250
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:10:13";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:40:13", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 17:40:13', '2', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6251

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8fb7e23927
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 17:40:13', '06ac8fb7e23927', '1', '0.00', '0', '0', '1', '10315.00', '10315', '10315', '0', '1', '2026-10-09 17:40:13', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '28' ,'0','','','','','-1','0','0','0','0','0','10315','0','','0','0','10315','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=359
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','359', '0', '2026-10-09 17:40:13', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10315', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 17:40:13','0','0','',''); -- id=468
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('375','08663', '359', '30', '964', '5', '395', '1975', '0', '', '0', '2026-10-09 17:40:13', '964', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','395','1975','0','','0','0.00','0','0','0','0'); -- id=1236
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 1236;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (964, '2026-10-09', 1975, 1875, 1875
                    , 1875, 1875, 1875, 1875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1875, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1975, sellCostBuyPrice =sellCostBuyPrice+1875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1975, 1875, 1875
                    , 1875, 1875, 1875, 1875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1875, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1975, sellCostBuyPrice =sellCostBuyPrice+1875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '70', userid = '2', storedetaildate = '2026-10-09 17:40:13' WHERE storedetailid = '964';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('964', '1', '5', '1', '359', 'اضافة فاتورة مبيعات', 'sellbillController.php', '75', '70', '2', '2026-10-09 17:40:13','0','0'); -- id=4185
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('405','09103', '359', '38', '1107', '5', '425', '2125', '0', '', '0', '2026-10-09 17:40:13', '1107', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','425','2125','0','','0','0.00','0','0','0','0'); -- id=1237
UPDATE sellbilldetail SET  lastbuyprice = 405.00 , meanbuyprice = 405.00, lastbuyprice_withDiscount = 405.00, meanbuyprice_withDiscount = 405.00
        , lastbuyprice_withTax = 405, meanbuyprice_withTax = 405, lastbuyprice_withDiscountAndTax = 405
                where sellbilldetailid = 1237;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1107, '2026-10-09', 2125, 2025, 2025
                    , 2025, 2025, 2025, 2025
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2025, 2025, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2125, sellCostBuyPrice =sellCostBuyPrice+2025
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2025, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2025
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2025, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2025
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2025
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2025
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2025
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2125, 2025, 2025
                    , 2025, 2025, 2025, 2025
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2025, 2025, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2125, sellCostBuyPrice =sellCostBuyPrice+2025
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2025, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2025
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2025, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2025
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2025
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2025
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2025
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '2', storedetaildate = '2026-10-09 17:40:13' WHERE storedetailid = '1107';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1107', '1', '5', '1', '359', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '19', '2', '2026-10-09 17:40:13','0','0'); -- id=4186
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('375','08663', '359', '30', '964', '5', '395', '1975', '0', '', '0', '2026-10-09 17:40:13', '964', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','395','1975','0','','0','0.00','0','0','0','0'); -- id=1238
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 1238;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (964, '2026-10-09', 1975, 1875, 1875
                    , 1875, 1875, 1875, 1875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1875, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1975, sellCostBuyPrice =sellCostBuyPrice+1875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1975, 1875, 1875
                    , 1875, 1875, 1875, 1875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1875, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1975, sellCostBuyPrice =sellCostBuyPrice+1875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 17:40:13' WHERE storedetailid = '964';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('964', '1', '5', '1', '359', 'اضافة فاتورة مبيعات', 'sellbillController.php', '70', '65', '2', '2026-10-09 17:40:13','0','0'); -- id=4187
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 80;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('288','01388', '359', '95', '1388', '3', '320', '960', '0', '', '0', '2026-10-09 17:40:13', '1388', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','80-3,','1','1','0','0','320','960','0','','0','0.00','0','0','0','0'); -- id=1239
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 288.00, meanbuyprice_withDiscount = 304.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 160, lastbuyprice_withDiscountAndTax = 288
                where sellbilldetailid = 1239;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1388, '2026-10-09', 960, 960, 960
                    , 960, 864, 912, 864
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 960, 480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+864, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+912
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+864
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 960, 960, 960
                    , 960, 864, 912, 864
                    , 0, 0, 0, 0
                    , 0, 0, 0, 960, 480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+864, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+912
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+864
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-09 17:40:13' WHERE storedetailid = '1388';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1388', '1', '3', '1', '359', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '24', '2', '2026-10-09 17:40:13','0','0'); -- id=4188
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 355;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('276','01467', '359', '104', '1467', '4', '340', '1360', '0', '', '0', '2026-10-09 17:40:13', '1467', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','355-4,','1','1','0','0','340','1360','0','','0','0.00','0','0','0','0'); -- id=1240
UPDATE sellbilldetail SET  lastbuyprice = 276.00 , meanbuyprice = 276.00, lastbuyprice_withDiscount = 276.00, meanbuyprice_withDiscount = 276.00
        , lastbuyprice_withTax = 276, meanbuyprice_withTax = 276, lastbuyprice_withDiscountAndTax = 276
                where sellbilldetailid = 1240;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1467, '2026-10-09', 1360, 1104, 1104
                    , 1104, 1104, 1104, 1104
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1104, 1104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1360, sellCostBuyPrice =sellCostBuyPrice+1104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1104, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1104
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1360, 1104, 1104
                    , 1104, 1104, 1104, 1104
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1104, 1104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1360, sellCostBuyPrice =sellCostBuyPrice+1104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1104, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1104
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '664', userid = '2', storedetaildate = '2026-10-09 17:40:13' WHERE storedetailid = '1492';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1467', '1', '4', '1', '359', 'اضافة فاتورة مبيعات', 'sellbillController.php', '668', '664', '2', '2026-10-09 17:40:13','0','0'); -- id=4189
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 218;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('290','01437', '359', '100', '1437', '6', '320', '1920', '0', '', '0', '2026-10-09 17:40:13', '1437', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','218-6,','1','1','0','0','320','1920','0','','0','0.00','0','0','0','0'); -- id=1241
UPDATE sellbilldetail SET  lastbuyprice = 290.00 , meanbuyprice = 287.50, lastbuyprice_withDiscount = 290.00, meanbuyprice_withDiscount = 287.50
        , lastbuyprice_withTax = 287.5, meanbuyprice_withTax = 287.5, lastbuyprice_withDiscountAndTax = 290
                where sellbilldetailid = 1241;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1437, '2026-10-09', 1920, 1710, 1740
                    , 1725, 1740, 1725, 1740
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1725, 1725, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1920, sellCostBuyPrice =sellCostBuyPrice+1710
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1740, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1725
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1740, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1725
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1740
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1725
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1725
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1920, 1710, 1740
                    , 1725, 1740, 1725, 1740
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1725, 1725, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1920, sellCostBuyPrice =sellCostBuyPrice+1710
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1740, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1725
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1740, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1725
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1740
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1725
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1725
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 17:40:13' WHERE storedetailid = '1450';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1437', '1', '6', '1', '359', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '9', '2', '2026-10-09 17:40:13','0','0'); -- id=4190
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2056928',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('2046613','10315', '0', '2', 'اضافة فاتورة مبيعات', '359', '2056928', '2026-10-09 17:40:13', '2',  'sellbillController.php','1','','0'); -- id=406
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10315', '10315', '2026-10-09', '2', '0', '0', '2026-10-09 17:40:13','اضافة فاتورة مبيعات رقم 359','1','0',null,'0','359','sellbillController.php?do=showDetail&sellbillid=359'); -- id=1859
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1859', '419', '10315', '','0'); -- id=1891
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '2056925', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1859', '143', '10315', '','0'); -- id=1859
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3628285', 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 ( '9483', '9483', '2026-10-09', '2', '0', '0', '2026-10-09 17:40:13','اضافة فاتورة مبيعات رقم 359 - صرف البضاعة من المخزن','1','0',null,'0','359','sellbillController.php?do=showDetail&sellbillid=359'); -- id=1860
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1860', '402', '9483', '','0'); -- id=1892
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3410962.73', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1860', '382', '9483', '','0'); -- id=1860
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20037188.47', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1859,0,1860' where sellbillid=359;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 10315, 9549, 9579
                    , 9564, 9483, 9516, 9483
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9564, 9084, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10315, sellCostBuyPrice =sellCostBuyPrice+9549
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9579, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9564
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9483, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9516
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9483
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9564
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9084
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 10315, 9549, 9579
                    , 9564, 9483, 9516, 9483
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9564, 9084, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10315, sellCostBuyPrice =sellCostBuyPrice+9549
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9579, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9564
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9483, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9516
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9483
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9564
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9084
                        , returnSellVal = returnSellVal+0, 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, 10315, 9549, 9579
                    , 9564, 9483, 9516, 9483, 9564, 9084)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10315, netSellCostBuyPrice = netSellCostBuyPrice+9549
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+9579
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+9564
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+9483
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+9516
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+9483
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+9564
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+9084;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:10:14";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:40:14", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 17:40:14', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6252
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:10:15";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:40:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 17:40:15', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6253
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:10:23";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:40:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 17:40:23', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6254
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:10:49";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:40:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 17:40:49', '1', 'details', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=details&id=18'); -- id=6255
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:11:18";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:41:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsnewController.php', '2026-10-09 17:41:18', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsnewController.php'); -- id=6256
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:11:20";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:41:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-09 17:41:20', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=6257
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:11:24";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:41:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 17:41:24', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6258
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:11:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:41:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 17:41:34', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6259
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:11:47";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:41:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 17:41:47', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6260
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:11:47";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 17:41:47', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6261
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:12:27";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:42:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 17:42:27', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=6262
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:12:37";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:42:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-09 17:42:37', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php'); -- id=6263
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:12:54";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:42:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 17:42:54', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=6264
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 ('شبابي اسبن العوضي','','86','100','125','125','125','2026-10-09','0','1','0','','0','0','0','0','0','100','100','100','100','100','0','25','0','0','.','0','0','0','100','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','100','100','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','100','0','0','0','0','0','0','','','0','0','0','0'); -- id=1811
UPDATE product SET productName = 'شبابي اسبن العوضي', productDescription = '', productCatId = '86', productBuyPrice = '100', productSellAllPrice = '125', productSellUnitPrice = '125', productSellHalfPrice = '125', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01811',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '100',lastbuyprice_withDiscount = '100',meanbuyprice = '100',meanbuyprice_withDiscount = '100' , productbuypricereal = '100' , buypricereal_precentage = '0' , buytotal_precentage = '25' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='100',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='100',meanbuyprice_withTax='100',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='100',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1811';
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', '1811', '1.00', '2026-10-09', '1', '0','0181101','125','125','125','100','','0','0','0','0','0','0','0','0','0','0'); -- id=1811
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1811', '1', '0', '1', '2026-10-09'); -- id=2825
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1811', '1', '0', '0', '1811', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4191
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1811, 1,'2026-10-09 17:42:54',1)
                ON DUPLICATE KEY UPDATE productid = 1811, edited = 1, sysdate = '2026-10-09 17:42:54', userid = 1; -- id=2731
UPDATE product SET productName = 'شبابي اسبن العوضي', productDescription = '', productCatId = '86', productBuyPrice = '100.00', productSellAllPrice = '125.00', productSellUnitPrice = '125.00', productSellHalfPrice = '125.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01811',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '100',lastbuyprice_withDiscount = '100',meanbuyprice = '100',meanbuyprice_withDiscount = '100' , productbuypricereal = '100' , buypricereal_precentage = '0' , buytotal_precentage = '25' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='100',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='100',meanbuyprice_withTax='100',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='100',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1811';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:12:55";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:42:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 17:42:55', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=6265
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:12:58";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:42:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 17:42:58', '1', 'bill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6266
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:13:01";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:43:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-09 17:43:01', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php?do=show'); -- id=6267
UPDATE productunit SET unitid = '1', productid = '1324', productnumber = '1.00', productunitdate = '2026-09-30', userid = '1', conditions = '0',proUnitParcode='0132401',proUnitSellAllPrice='390',proUnitSellHalfPrice='390',proUnitSellUnitPrice ='390',proUnitBuyPrice='350',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '1324';
UPDATE product SET productName = 'موديل ايطالي العوضي', productDescription = '', productCatId = '86', productBuyPrice = '360', productSellAllPrice = '390', productSellUnitPrice = '390', productSellHalfPrice = '390', productDate = '2026-09-30', conditions = '0', userId = '1', limitamount = '0', parcode = '01324',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350.00',lastbuyprice_withDiscount = '350',meanbuyprice = '350.00',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '11.43' , buyhalf_precentage = '11.43' , buypart_precentage = '11.43',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',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='350',meanbuyprice_withTax='350',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='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1324';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:16:15";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:46:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 17:46:15', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=6268
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 ('06ac8fd7268d71', '2026-10-09 17:42:58', '74', '290980.00', '730360', '0', '0', '439380.00',  '439380.00', '0', '439380', '1', '2026-10-09 17:46:15', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=98
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 ('01324', '98', '86', '1324', '868', '360', '312480.00', '0', '', '2026-10-09 17:46:15', '1324','','','0','0','0','0','0',null,'360','312480','0','0','0','0','0','0','0','0','1'); -- id=634
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 17:42:58', 1, 1324, 0, 0
                    , 360, 868, 0, 0, 1, '2026-10-09 17:46:16')
                ON DUPLICATE KEY UPDATE buyprice = 360,
                        buyQuantity =buyQuantity+868, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 17:46:16' ; -- id=810
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1324', '360', '868', '0', 'buyBillController.php', '634', '', '0', '0'); -- id=501
UPDATE product SET  productBuyPrice = "360" WHERE productId = 1324 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 634 ;
UPDATE product SET productName = 'موديل ايطالي العوضي', productDescription = '', productCatId = '86', productBuyPrice = '360.00', productSellAllPrice = '390.00', productSellUnitPrice = '390.00', productSellHalfPrice = '390.00', productDate = '2026-09-30', conditions = '0', userId = '1', limitamount = '0', parcode = '01324',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360',lastbuyprice_withDiscount = '360',meanbuyprice = '355.63',meanbuyprice_withDiscount = '355.63' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '11.43' , buyhalf_precentage = '11.43' , buypart_precentage = '11.43',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',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='360',meanbuyprice_withTax='355.63',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='360',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1324';
UPDATE buybilldetail SET  lastbuyprice = 360 , meanbuyprice = 355.63, lastbuyprice_withDiscount = 360, meanbuyprice_withDiscount = 355.63
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 355.63, lastbuyprice_withDiscountAndTax = 360
                where buybilldetailid = 634;
UPDATE productunit SET proUnitBuyPrice  = 360 * productnumber WHERE productid = 1324;
UPDATE storedetail SET  productquantity = '868', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1324';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '1', '868', '0', '98', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '868', '1', '2026-10-09 17:42:58','0','0'); -- id=4192
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 ('01811', '98', '86', '1811', '1269', '100', '126900.00', '0', '', '2026-10-09 17:46:15', '1811','','','0','0','0','0','0',null,'100','126900','0','0','0','0','0','0','0','0','1'); -- id=635
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 17:42:58', 1, 1811, 0, 0
                    , 100, 1269, 0, 0, 1, '2026-10-09 17:46:16')
                ON DUPLICATE KEY UPDATE buyprice = 100,
                        buyQuantity =buyQuantity+1269, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 17:46:16' ; -- id=811
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1811', '100', '1269', '0', 'buyBillController.php', '635', '', '0', '0'); -- id=502
UPDATE product SET  productBuyPrice = "100" WHERE productId = 1811 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 635 ;
UPDATE product SET productName = 'شبابي اسبن العوضي', productDescription = '', productCatId = '86', productBuyPrice = '100.00', productSellAllPrice = '125.00', productSellUnitPrice = '125.00', productSellHalfPrice = '125.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01811',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '100',lastbuyprice_withDiscount = '100',meanbuyprice = '100',meanbuyprice_withDiscount = '100' , productbuypricereal = '100.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '25.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='100',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='100',meanbuyprice_withTax='100',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='100',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1811';
UPDATE buybilldetail SET  lastbuyprice = 100 , meanbuyprice = 100, lastbuyprice_withDiscount = 100, meanbuyprice_withDiscount = 100
        , lastbuyprice_withTax = 100, meanbuyprice_withTax = 100, lastbuyprice_withDiscountAndTax = 100
                where buybilldetailid = 635;
UPDATE productunit SET proUnitBuyPrice  = 100 * productnumber WHERE productid = 1811;
UPDATE storedetail SET  productquantity = '1269', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2825';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1811', '1', '1269', '0', '98', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '1269', '1', '2026-10-09 17:42:58','0','0'); -- id=4193
UPDATE supplier SET  suppliercurrentDebt = '730360',suppliercurrentDebtInCurrency= '730360' , userid = '1', supplierdate = '2026-10-09 17:46:15'   WHERE supplierid = '74';
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 ('74', '290980.00', '439380', '0', 'اضافة فاتورة مشتريات', '98', '730360', '2026-10-09 17:42:58', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','439380','1','290980','439380','730360','0',''); -- id=296
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '439380', '439380', '2026-10-09', '1', '0', '0', '2026-10-09 17:46:16','اضافة فاتورة مشتريات رقم 98','1','0',null,'0','98','buyBillController.php?do=details&id=98'); -- id=1861
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1861', '382', '439380', '','0'); -- id=1893
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20476568.47', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1861', '494', '439380', '','0'); -- id=1861
UPDATE accountstree SET name = 'محمد العوضي تريكو', customName = 'محمد العوضي تريكو', customNameEn = 'محمد العوضي تريكو', nameEn = 'محمد العوضي تريكو', parent = '81', accountNature = '1', theValue = '730360', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 10:33:20' WHERE id = '494';
update buybill set dailyentryid='1861,0' where buybillid=98;
COMMIT;
UPDATE product SET overAllAveragePrice = 355.2 WHERE productId = 1324;UPDATE product SET overAllAveragePrice = 100 WHERE productId = 1811;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:16:16";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:46:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 17:46:16', '1', 'editprint', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=98'); -- id=6269
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:16:18";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:46:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 17:46:18', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6270
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:16:27";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:46:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 17:46:27', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6271
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:18:25";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:48:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnBuyBillController.php', '2026-10-09 17:48:25', '1', 'details', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/returnBuyBillController.php?do=details&id=14'); -- id=6272
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:20:42";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:20:46";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:50:46", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 17:50:46', '6', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6273
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:20:46";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 17:50:46", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 17:50:46', '6', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6274
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:20:49";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:50:49", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 17:50:49', '6', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6275
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:20:55";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:50:55", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 17:50:55', '6', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6276
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:21:42";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:51:42", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 17:51:42', '6', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6277

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac8ff4fd7f69
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 17:51:42', '06ac8ff4fd7f69', '1', '0.00', '0', '0', '1', '29100.00', '29100', '29100', '0', '1', '2026-10-09 17:51:42', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '44' ,'0','','','','','-1','0','0','0','0','0','29100','0','','0','0','29100','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=360
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','360', '0', '2026-10-09 17:51:42', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '29100', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 17:51:42','0','0','',''); -- id=469
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+24 where id = 454;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('700','01598', '360', '118', '1598', '24', '800', '19200', '0', '', '0', '2026-10-09 17:51:42', '1598', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','454-24,','1','1','0','0','800','19200','0','','0','0.00','0','0','0','0'); -- id=1242
UPDATE sellbilldetail SET  lastbuyprice = 700.00 , meanbuyprice = 700.00, lastbuyprice_withDiscount = 700.00, meanbuyprice_withDiscount = 700.00
        , lastbuyprice_withTax = 700, meanbuyprice_withTax = 700, lastbuyprice_withDiscountAndTax = 700
                where sellbilldetailid = 1242;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1598, '2026-10-09', 19200, 16800, 16800
                    , 16800, 16800, 16800, 16800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24, 0, 16800, 16800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19200, sellCostBuyPrice =sellCostBuyPrice+16800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+16800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+16800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+16800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+16800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+16800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+16800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+16800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-10-09', 19200, 16800, 16800
                    , 16800, 16800, 16800, 16800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16800, 16800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19200, sellCostBuyPrice =sellCostBuyPrice+16800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+16800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+16800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+16800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+16800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+16800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+16800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+16800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '572', userid = '6', storedetaildate = '2026-10-09 17:51:42' WHERE storedetailid = '1623';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1598', '1', '24', '1', '360', 'اضافة فاتورة مبيعات', 'sellbillController.php', '596', '572', '6', '2026-10-09 17:51:42','0','0'); -- id=4194
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 449;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('420','01597', '360', '117', '1597', '20', '495', '9900', '0', '', '0', '2026-10-09 17:51:42', '1597', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','449-20,','1','1','0','0','495','9900','0','','0','0.00','0','0','0','0'); -- id=1243
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 420.00, lastbuyprice_withDiscount = 420.00, meanbuyprice_withDiscount = 420.00
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 420
                where sellbilldetailid = 1243;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1597, '2026-10-09', 9900, 8400, 8400
                    , 8400, 8400, 8400, 8400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 8400, 8400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9900, sellCostBuyPrice =sellCostBuyPrice+8400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 9900, 8400, 8400
                    , 8400, 8400, 8400, 8400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8400, 8400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9900, sellCostBuyPrice =sellCostBuyPrice+8400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '99', userid = '6', storedetaildate = '2026-10-09 17:51:42' WHERE storedetailid = '1622';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1597', '1', '20', '1', '360', 'اضافة فاتورة مبيعات', 'sellbillController.php', '119', '99', '6', '2026-10-09 17:51:42','0','0'); -- id=4195
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '120725',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('91625','29100', '0', '4', 'اضافة فاتورة مبيعات', '360', '120725', '2026-10-09 17:51:42', '6',  'sellbillController.php','1','','0'); -- id=407
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '29100', '29100', '2026-10-09', '6', '0', '0', '2026-10-09 17:51:42','اضافة فاتورة مبيعات رقم 360','1','0',null,'0','360','sellbillController.php?do=showDetail&sellbillid=360'); -- id=1862
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1862', '568', '29100', '','0'); -- id=1894
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '120725', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1862', '143', '29100', '','0'); -- id=1862
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3657385', 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 ( '25200', '25200', '2026-10-09', '6', '0', '0', '2026-10-09 17:51:42','اضافة فاتورة مبيعات رقم 360 - صرف البضاعة من المخزن','1','0',null,'0','360','sellbillController.php?do=showDetail&sellbillid=360'); -- id=1863
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1863', '402', '25200', '','0'); -- id=1895
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3436162.73', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1863', '382', '25200', '','0'); -- id=1863
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20451368.47', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1862,0,1863' where sellbillid=360;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 29100, 25200, 25200
                    , 25200, 25200, 25200, 25200
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,25200, 25200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+29100, sellCostBuyPrice =sellCostBuyPrice+25200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+25200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+25200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+25200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+25200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+25200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+25200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+25200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 29100, 25200, 25200
                    , 25200, 25200, 25200, 25200
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,25200, 25200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+29100, sellCostBuyPrice =sellCostBuyPrice+25200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+25200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+25200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+25200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+25200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+25200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+25200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+25200
                        , returnSellVal = returnSellVal+0, 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, 29100, 25200, 25200
                    , 25200, 25200, 25200, 25200, 25200, 25200)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+29100, netSellCostBuyPrice = netSellCostBuyPrice+25200
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+25200
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+25200
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+25200
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+25200
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+25200
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+25200
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+25200;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:21:42";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:51:42", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 17:51:42', '6', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6278
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:25:08";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:55:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 17:55:08', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6279
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:25:15";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:55:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 17:55:15', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6280
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:28:38";
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 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 blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:29:04";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:59:04", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 17:59:04', '3', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6281
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:29:04";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 17:59:04', '3', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6282
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:29:07";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:59:07", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 17:59:07', '3', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6283
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:29:07";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:59:07", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 17:59:07', '3', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6284
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:29:32";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:59:32", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 17:59:32', '3', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6285
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:29:32";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 17:59:32', '3', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6286
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:29:32";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:59:32", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 17:59:32', '2', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6287
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:29:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:59:34", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 17:59:34', '3', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6288
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:29:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 17:59:34", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 17:59:34', '3', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6289
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:30:22";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:00:22", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:00:22', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6290
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:30:29";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:00:29", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:00:29', '3', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6291
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:30:29";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:00:29", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:00:29', '3', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6292
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:36:26";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:06:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 18:06:26', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6293
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:36:31";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:06:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 18:06:31', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6294
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:37:04";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:07:04", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:07:04', '3', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6295

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac9018dd97dc
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 18:07:04', '06ac9018dd97dc', '1', '0.00', '0', '260', '1', '27060.00', '26800', '26800', '0', '1', '2026-10-09 18:07:04', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '69' ,'0','','','','','-1','0','0','0','0','0','26800','0','','0','0','26800','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=361
UPDATE client SET  clientdebt = '0', userid = '3' 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','اضافة فاتورة مبيعات','361', '0', '2026-10-09 18:07:04', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '26800', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 18:07:04','0','0','',''); -- id=470
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+16 where id = 154;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('419.99','01404', '361', '99', '1404', '16', '420', '6720', '0', '', '0', '2026-10-09 18:07:04', '1404', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','154-16,','1','1','0','0','420','6720','0','','0','0.00','0','0','0','0'); -- id=1244
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 420.00, lastbuyprice_withDiscount = 419.99, meanbuyprice_withDiscount = 419.99
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 419.99
                where sellbilldetailid = 1244;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1404, '2026-10-09', 6655.4323725055, 6720, 6720
                    , 6720, 6719.84, 6719.84, 6719.84
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 6720, 6720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6655.4323725055, sellCostBuyPrice =sellCostBuyPrice+6720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6719.84, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6719.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6719.84
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 6655.4323725055, 6720, 6720
                    , 6720, 6719.84, 6719.84, 6719.84
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6720, 6720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6655.4323725055, sellCostBuyPrice =sellCostBuyPrice+6720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6719.84, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6719.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6719.84
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '548', userid = '3', storedetaildate = '2026-10-09 18:07:04' WHERE storedetailid = '1417';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1404', '1', '16', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '564', '548', '3', '2026-10-09 18:07:04','0','0'); -- id=4196
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 735;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('324','01777', '361', '99', '1777', '12', '360', '4320', '0', '', '0', '2026-10-09 18:07:04', '1777', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','735-12,','1','1','0','0','360','4320','0','','0','0.00','0','0','0','0'); -- id=1245
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 324.00, meanbuyprice_withDiscount = 324.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 324
                where sellbilldetailid = 1245;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1777, '2026-10-09', 4278.4922394678, 4320, 4320
                    , 4320, 3888, 3888, 3888
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4320, 4320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4278.4922394678, sellCostBuyPrice =sellCostBuyPrice+4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3888, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3888
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3888
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4278.4922394678, 4320, 4320
                    , 4320, 3888, 3888, 3888
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4320, 4320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4278.4922394678, sellCostBuyPrice =sellCostBuyPrice+4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3888, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3888
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3888
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '132', userid = '3', storedetaildate = '2026-10-09 18:07:04' WHERE storedetailid = '2790';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1777', '1', '12', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '144', '132', '3', '2026-10-09 18:07:04','0','0'); -- id=4197
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 559;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('386.4','01695', '361', '127', '1695', '9', '420', '3780', '0', '', '0', '2026-10-09 18:07:04', '1695', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','559-9,','1','1','0','0','420','3780','0','','0','0.00','0','0','0','0'); -- id=1246
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 420.00, lastbuyprice_withDiscount = 386.40, meanbuyprice_withDiscount = 386.40
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 386.4
                where sellbilldetailid = 1246;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1695, '2026-10-09', 3743.6807095344, 3780, 3780
                    , 3780, 3477.6, 3477.6, 3477.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3780, 3780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3743.6807095344, sellCostBuyPrice =sellCostBuyPrice+3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3477.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3477.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3477.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3743.6807095344, 3780, 3780
                    , 3780, 3477.6, 3477.6, 3477.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3780, 3780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3743.6807095344, sellCostBuyPrice =sellCostBuyPrice+3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3477.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3477.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3477.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '144', userid = '3', storedetaildate = '2026-10-09 18:07:04' WHERE storedetailid = '2707';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1695', '1', '9', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '153', '144', '3', '2026-10-09 18:07:04','0','0'); -- id=4198
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 404;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('337.5','01583', '361', '114', '1583', '8', '375', '3000', '0', '', '0', '2026-10-09 18:07:04', '1583', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','404-8,','1','1','0','0','375','3000','0','','0','0.00','0','0','0','0'); -- id=1247
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 337.50, meanbuyprice_withDiscount = 337.50
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 337.5
                where sellbilldetailid = 1247;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1583, '2026-10-09', 2971.1751662971, 3000, 3000
                    , 3000, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 3000, 3000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2971.1751662971, sellCostBuyPrice =sellCostBuyPrice+3000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2971.1751662971, 3000, 3000
                    , 3000, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3000, 3000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2971.1751662971, sellCostBuyPrice =sellCostBuyPrice+3000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '3', storedetaildate = '2026-10-09 18:07:04' WHERE storedetailid = '1608';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1583', '1', '8', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16', '8', '3', '2026-10-09 18:07:04','0','0'); -- id=4199
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 82;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('378','01390', '361', '95', '1390', '12', '420', '5040', '0', '', '0', '2026-10-09 18:07:04', '1390', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','82-12,','1','1','0','0','420','5040','0','','0','0.00','0','0','0','0'); -- id=1248
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 420.00, lastbuyprice_withDiscount = 378.00, meanbuyprice_withDiscount = 399.00
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 210, lastbuyprice_withDiscountAndTax = 378
                where sellbilldetailid = 1248;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1390, '2026-10-09', 4991.5742793792, 5040, 5040
                    , 5040, 4536, 4788, 4536
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 5040, 2520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4991.5742793792, sellCostBuyPrice =sellCostBuyPrice+5040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4536, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4788
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4536
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4991.5742793792, 5040, 5040
                    , 5040, 4536, 4788, 4536
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5040, 2520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4991.5742793792, sellCostBuyPrice =sellCostBuyPrice+5040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4536, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4788
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4536
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '3', storedetaildate = '2026-10-09 18:07:04' WHERE storedetailid = '1390';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1390', '1', '12', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60', '48', '3', '2026-10-09 18:07:04','0','0'); -- id=4200
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 773;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('315','01652', '361', '123', '1652', '12', '350', '4200', '0', '', '0', '2026-10-09 18:07:04', '1652', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','773-12,','1','1','0','0','350','4200','0','','0','0.00','0','0','0','0'); -- id=1249
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 315.00, meanbuyprice_withDiscount = 332.50
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 175, lastbuyprice_withDiscountAndTax = 315
                where sellbilldetailid = 1249;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1652, '2026-10-09', 4159.645232816, 4200, 4200
                    , 4200, 3780, 3990, 3780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4200, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4159.645232816, sellCostBuyPrice =sellCostBuyPrice+4200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3990
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4159.645232816, 4200, 4200
                    , 4200, 3780, 3990, 3780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4200, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4159.645232816, sellCostBuyPrice =sellCostBuyPrice+4200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3990
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '3', storedetaildate = '2026-10-09 18:07:04' WHERE storedetailid = '1677';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1652', '1', '12', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '12', '3', '2026-10-09 18:07:04','0','0'); -- id=4201
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2083728',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('2056928','26800', '0', '2', 'اضافة فاتورة مبيعات', '361', '2083728', '2026-10-09 18:07:04', '3',  'sellbillController.php','1','','0'); -- id=408
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '27060', '27060', '2026-10-09', '3', '0', '0', '2026-10-09 18:07:04','اضافة فاتورة مبيعات رقم 361','1','0',null,'0','361','sellbillController.php?do=showDetail&sellbillid=361'); -- id=1864
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1864', '419', '26800', '','0'); -- id=1896
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '2083725', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1864', '398', '260', '','0'); -- id=1897
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '138038', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1864', '143', '27060', '','0'); -- id=1864
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3684445', 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 ( '25101.44', '25101.44', '2026-10-09', '3', '0', '0', '2026-10-09 18:07:04','اضافة فاتورة مبيعات رقم 361 - صرف البضاعة من المخزن','1','0',null,'0','361','sellbillController.php?do=showDetail&sellbillid=361'); -- id=1865
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1865', '402', '25101.44', '','0'); -- id=1898
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3461264.17', 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 ('1865', '382', '25101.44', '','0'); -- id=1865
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20426267.03', 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='1864,0,1865' where sellbillid=361;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 26800, 27060, 27060
                    , 27060, 25101.44, 25563.44, 25101.44
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,27060, 22440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+26800, sellCostBuyPrice =sellCostBuyPrice+27060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+25101.44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+25563.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+25101.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 26800, 27060, 27060
                    , 27060, 25101.44, 25563.44, 25101.44
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,27060, 22440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+26800, sellCostBuyPrice =sellCostBuyPrice+27060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+25101.44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+25563.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+25101.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22440
                        , returnSellVal = returnSellVal+0, 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, 26800, 27060, 27060
                    , 27060, 25101.44, 25563.44, 25101.44, 27060, 22440)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+26800, netSellCostBuyPrice = netSellCostBuyPrice+27060
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+27060
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+27060
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+25101.44
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+25563.44
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+25101.44
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+27060
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+22440;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac9018dd97dc and sellbillId = 361 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:37:04";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:07:04", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:07:04', '3', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6296
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:38:32";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:08:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 18:08:32', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=6297
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:38:42";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:08:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storereportController.php', '2026-10-09 18:08:42', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storereportController.php'); -- id=6298
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:38:48";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:08:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('salesreport.php', '2026-10-09 18:08:48', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/salesreport.php'); -- id=6299
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:38:50";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:08:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-09 18:08:50', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php'); -- id=6300
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:38:58";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:08:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-09 18:08:58', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php?do=show'); -- id=6301
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:39:58";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:09:58", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:09:58', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=222'); -- id=6302
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:40:02";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:10:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 18:10:02', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6303
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:40:02";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:10:02", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 18:10:02', '3', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6304
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:40:02";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:10:02", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 18:10:02', '3', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6305
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:40:05";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:10:05", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:10:05', '2', 'showDetail', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=359'); -- id=6306
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:40:07";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:10:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 18:10:07', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6307
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:40:11";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:10:11", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 18:10:11', '3', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php?do=show'); -- id=6308
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:40:18";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:10:18", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:10:18', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6309
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:40:21";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:10:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 18:10:21', '1', 'bill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=6'); -- id=6310
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:40:29";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:10:29", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:10:29', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=222'); -- id=6311
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:40:45";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:10:45", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:10:45', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6312
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:42:10";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:12:10", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:12:10', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=222'); -- id=6313
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:43:13";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:13:13", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:13:13', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=222'); -- id=6314
UPDATE user SET loginip = "" WHERE userid = 2;
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:43:33";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:13:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 18:13:33', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6315
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:43:33";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 18:13:33', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6316
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:43:49";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:13:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientsAndProductsReportController.php', '2026-10-09 18:13:49', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientsAndProductsReportController.php'); -- id=6317
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:44:10";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:14:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientsAndProductsReportController.php', '2026-10-09 18:14:10', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientsAndProductsReportController.php?do=show'); -- id=6318
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:44:16";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:14:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 18:14:16', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php'); -- id=6319
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:44:17";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:14:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 18:14:17', '1', 'showallajax', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php?do=showallajax'); -- id=6320
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:44:23";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:14:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 18:14:23', '1', 'details', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=details&id=16'); -- id=6321
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:44:29";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:14:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 18:14:29', '1', 'showallajax', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php?do=showallajax'); -- id=6322
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:44:32";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:14:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 18:14:32', '1', 'showallajax', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php?do=showallajax'); -- id=6323
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:44:38";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:14:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 18:14:38', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=6324
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:44:46";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:14:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:14:46', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6325
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:44:52";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:14:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 18:14:52', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=6326
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:44:58";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:14:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 18:14:58', '1', 'editbill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=16'); -- id=6327
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:45:05";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:15:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:15:05', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6328
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:45:10";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:15:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 18:15:10', '1', 'update', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=update'); -- id=6329
BEGIN;
UPDATE costcenterdetail SET del = 1 WHERE type in( 3) and  modelid = 16;
UPDATE buybill SET  buybillsysdate = '2026-10-09 18:15:10', userid = '1',delbyuserid = '1', conditions = '1' WHERE buybillid = '16';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-01 17:30:57', 1, 1247, 0, 0
                    , 190, 136, 0, 0, 1, '2026-10-09 18:15:10')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-136, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-09 18:15:10' ; -- id=63
UPDATE product SET productName = 'موديلات سيفن ار 200', productDescription = '', productCatId = '71', productBuyPrice = '190.00', productSellAllPrice = '200.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09745',type ='0', expireDate = '0' , dailyentryId = '602',isService = '0',isOptic = '0',lastbuyprice = '190',lastbuyprice_withDiscount = '190',meanbuyprice = '190',meanbuyprice_withDiscount = '190' , productbuypricereal = '180.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='190',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9745',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='190',meanbuyprice_withTax='190',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1247';
UPDATE productunit SET proUnitBuyPrice  = 190 * productnumber WHERE productid = 1247;
UPDATE storedetail SET  productquantity = '-136', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1247';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1247', '1', '136', '1', '16', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '0', '-136', '1', '2026-10-01 17:30:57','0','0'); -- id=4202
UPDATE supplier SET  suppliercurrentDebt = '457565',suppliercurrentDebtInCurrency= '457565' , userid = '1', supplierdate = '2026-10-09 18:15:10'   WHERE supplierid = '25';
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 ('25', '483405.00', '25840.00', '1', 'حذف فاتورة مشتريات - للتعديل', '16', '457565', '2026-10-01 17:30:57', '1', 'buyBillController.php', 'حذف فاتورة مشتريات - للتعديل', '0','', '0','1','1','25840','1','483405','25840','457565','0',''); -- id=297
UPDATE productserial SET del = 1
		 WHERE billid = 16;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,deletedbuyid,controlname,payedtax,costcenterid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06abe6ea18bec3', '2026-10-01 17:30:57', '25', '457565.00', '485495', '0', '0', '27930.00', '27930.00', '0.00', '27930', '1', '2026-10-09 18:15:10', '', '1', '0', '', '1', '1','1','16','buyBillController.php','0.00','-1','1','0','0','.','0','0','0','0','0','0'); -- id=99
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 ('09745', '99', '71', '1247', '147.00', '190', '27930.00', '0.00', '', '2026-10-09 18:15:10', '1247','','','0','0','0','0','0',null,'190','27930','0','0','0','0','0','0','0','0','1'); -- id=636
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-01 17:30:57', 1, 1247, 0, 0
                    , 190, 147, 0, 0, 1, '2026-10-09 18:15:10')
                ON DUPLICATE KEY UPDATE buyprice = 190,
                        buyQuantity =buyQuantity+147, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 18:15:10' ; -- id=63
UPDATE product SET  productBuyPrice = "190" WHERE productId = 1247 ;
UPDATE buybilldetail SET  quantitybefore = -136 WHERE buybilldetailid = 636 ;
UPDATE product SET productName = 'موديلات سيفن ار 200', productDescription = '', productCatId = '71', productBuyPrice = '190.00', productSellAllPrice = '200.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09745',type ='0', expireDate = '0' , dailyentryId = '602',isService = '0',isOptic = '0',lastbuyprice = '190',lastbuyprice_withDiscount = '190',meanbuyprice = '190',meanbuyprice_withDiscount = '190' , productbuypricereal = '180.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='190',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9745',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='190',meanbuyprice_withTax='190',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='190',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1247';
UPDATE buybilldetail SET  lastbuyprice = 190 , meanbuyprice = 190, lastbuyprice_withDiscount = 190, meanbuyprice_withDiscount = 190
        , lastbuyprice_withTax = 190, meanbuyprice_withTax = 190, lastbuyprice_withDiscountAndTax = 190
                where buybilldetailid = 636;
UPDATE productunit SET proUnitBuyPrice  = 190 * productnumber WHERE productid = 1247;
UPDATE storedetail SET  productquantity = '11', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1247';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1247', '1', '147', '0', '99', 'اضافة فاتورة مشتريات', 'buyBillController.php', '-136', '11', '1', '2026-10-01 17:30:57','0','0'); -- id=4203
DELETE FROM productserial WHERE billid = 16
		and type =0 
		;
UPDATE supplier SET  suppliercurrentDebt = '485495',suppliercurrentDebtInCurrency= '485495' , userid = '1', supplierdate = '2026-10-09 18:15:10'   WHERE supplierid = '25';
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 ('25', '457565.00', '27930', '0', 'اضافة فاتورة مشتريات', '99', '485495', '2026-10-09 18:15:10', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','25840','1','457565','27930','485495','0',''); -- id=298
UPDATE dailyentry SET totalcreditor = '25840.00', totaldebtor = '25840.00', thedate = '2026-10-01', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-01 17:31:24', entryComment = 'اضافة فاتورة مشتريات رقم 16', fromFlag = '1',related='0',isopeningentry='0',operationId='16',operationDetailLink='buyBillController.php?do=details&id=16' WHERE id = '893';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '25840.00', '25840.00', '2026-10-09', '1', '0', '893', '2026-10-09 18:15:10','تم عكس القيد رقم 893 ','1','0','-1','0','0',''); -- id=1866
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1866', '382', '25840.00', '','0'); -- id=1866
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20400427.03', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1866', '444', '25840.00', '','0'); -- id=1899
UPDATE accountstree SET name = 'سيفن ار - مورد', customName = 'سيفن ار - مورد', customNameEn = 'سيفن ار - مورد', nameEn = 'سيفن ار - مورد', parent = '81', accountNature = '1', theValue = '-218510', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '444';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '27930', '27930', '2026-10-09', '1', '0', '0', '2026-10-09 18:15:10','اضافة فاتورة مشتريات رقم 99','1','0',null,'0','99','buyBillController.php?do=details&id=99'); -- id=1867
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1867', '382', '27930', '','0'); -- id=1900
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20428357.03', 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 ('1867', '444', '27930', '','0'); -- id=1867
UPDATE accountstree SET name = 'سيفن ار - مورد', customName = 'سيفن ار - مورد', customNameEn = 'سيفن ار - مورد', nameEn = 'سيفن ار - مورد', parent = '81', accountNature = '1', theValue = '-190580', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '444';
update buybill set dailyentryid='1867,0' where buybillid=99;
UPDATE product SET overAllAveragePrice = 190 WHERE productId = 1247;;
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:45:10";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:15:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 18:15:10', '1', 'editprint', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=99'); -- id=6330
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:45:14";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:15:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:15:14', '1', 'showDetail', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=244'); -- id=6331
UPDATE user SET loginip = "" WHERE userid = 1;
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:45:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:15:34", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 18:15:34', '2', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6332
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:45:34";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 18:15:34", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 18:15:34', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6333
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:46:16";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:16:16", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:16:16', '3', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6334
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:46:16";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:16:16", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:16:16', '3', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6335
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:46:30";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:16:30", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:16:30', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6336
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:47:46";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:17:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-09 18:17:47', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php'); -- id=6337
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:49:49";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:19:49", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:19:49', '3', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6338

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac90540aab40
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 18:19:49', '06ac90540aab40', '1', '0.00', '0', '0', '1', '3000.00', '3000', '3000', '0', '1', '2026-10-09 18:19:49', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '9' ,'0','','','','','-1','0','0','0','0','0','3000','0','','0','0','3000','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=362
UPDATE client SET  clientdebt = '0', userid = '3' 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','اضافة فاتورة مبيعات','362', '0', '2026-10-09 18:19:49', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3000', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 18:19:49','0','0','',''); -- id=471
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','01379', '362', '94', '1379', '6', '300', '1800', '0', '', '0', '2026-10-09 18:19:49', '1379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','71-6,','1','1','0','0','300','1800','0','','0','0.00','0','0','0','0'); -- id=1250
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1250;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-09', 1800, 1620, 1620
                    , 1620, 1620, 1620, 1620
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1620, 1620, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1800, sellCostBuyPrice =sellCostBuyPrice+1620
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1620, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1620
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1620, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1620
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1620
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1620
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1620
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1800, 1620, 1620
                    , 1620, 1620, 1620, 1620
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1620, 1620, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1800, sellCostBuyPrice =sellCostBuyPrice+1620
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1620, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1620
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1620, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1620
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1620
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1620
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1620
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '615', userid = '3', storedetaildate = '2026-10-09 18:19:49' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '6', '1', '362', 'اضافة فاتورة مبيعات', 'sellbillController.php', '621', '615', '3', '2026-10-09 18:19:49','0','0'); -- id=4204
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 74;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','01382', '362', '94', '1382', '3', '400', '1200', '0', '', '0', '2026-10-09 18:19:49', '1382', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','74-3,','1','1','0','0','400','1200','0','','0','0.00','0','0','0','0'); -- id=1251
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1251;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1382, '2026-10-09', 1200, 1080, 1080
                    , 1080, 1080, 1080, 1080
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1200, 1080, 1080
                    , 1080, 1080, 1080, 1080
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '51', userid = '3', storedetaildate = '2026-10-09 18:19:49' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '3', '1', '362', 'اضافة فاتورة مبيعات', 'sellbillController.php', '54', '51', '3', '2026-10-09 18:19:49','0','0'); -- id=4205
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2086728',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('2083728','3000', '0', '2', 'اضافة فاتورة مبيعات', '362', '2086728', '2026-10-09 18:19:49', '3',  'sellbillController.php','1','','0'); -- id=409
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3000', '3000', '2026-10-09', '3', '0', '0', '2026-10-09 18:19:49','اضافة فاتورة مبيعات رقم 362','1','0',null,'0','362','sellbillController.php?do=showDetail&sellbillid=362'); -- id=1868
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1868', '419', '3000', '','0'); -- id=1901
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '2086725', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1868', '143', '3000', '','0'); -- id=1868
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3687445', 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 ( '2700', '2700', '2026-10-09', '3', '0', '0', '2026-10-09 18:19:49','اضافة فاتورة مبيعات رقم 362 - صرف البضاعة من المخزن','1','0',null,'0','362','sellbillController.php?do=showDetail&sellbillid=362'); -- id=1869
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1869', '402', '2700', '','0'); -- id=1902
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3463964.17', 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 ('1869', '382', '2700', '','0'); -- id=1869
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20425657.03', 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='1868,0,1869' where sellbillid=362;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 3000, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3000, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, 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, 3000, 2700, 2700
                    , 2700, 2700, 2700, 2700, 2700, 2700)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3000, netSellCostBuyPrice = netSellCostBuyPrice+2700
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2700
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2700
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2700
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2700
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2700
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2700
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2700;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac90540aab40 and sellbillId = 362 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:49:49";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:19:49", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:19:49', '3', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6339
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:50:13";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:20:13", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:20:13', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6340
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:50:36";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:20:36", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:20:36', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6341
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:50:38";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:20:38", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:20:38', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6342
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:54:09";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:24:09", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:24:09', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6343
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:55:26";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:25:26", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:25:26', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6344
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:58:37";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:28:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 18:28:37', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6345
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:58:38";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 18:28:38', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6346
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 14:58:50";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:28:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-09 18:28:50', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=6347
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:00:14";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:30:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-09 18:30:14', '1', 'add2', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=add2'); -- id=6348
INSERT INTO productcat (productCatName, productCatDate, productCatDescription, productCatParent, userId, conditions, selldiscount, buydiscount, discounttype,isOptic , buytotal , buyhalf , buypart ,buypricereal,opticServices,logo,inMenu,stopNegativeSale,catExcelid,webApiId,obygyInvestigationCatId,price4,price5,price6,price7,price8,price9,price10,price11,price12,price13) VALUES ('دبل اس','2026-10-09','','93', '1','0', '0', '0', '-1', '0', '0', '0', '0','0','','.','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0'); -- id=140
INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES (140, 1,'2026-10-09 18:30:14',1)
                ON DUPLICATE KEY UPDATE catid = 140, edited = 1, sysdate = '2026-10-09 18:30:14', userid = 1; -- id=152
INSERT INTO productcatunit (unitid, productcatid, productnumber, productcatunitdate, userid, conditions) VALUES ('1', '140', '1', '2026-10-09', '1', '0'); -- id=54
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:00:14";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:30:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-09 18:30:14', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=sucess'); -- id=6349
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:00:16";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:30:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-09 18:30:16', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=show'); -- id=6350
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:00:33";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:30:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 18:30:33', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=6351
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:07:12";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:37:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 18:37:13', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=6352
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 ('HDS/W27/001','','140','580','580','580','580','2026-10-09','0','1','0','','0','0','0','0','0','580','580','580','580','580','0','0','0','0','.','0','0','0','580','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','580','580','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','580','0','0','0','0','0','0','','','0','0','0','0'); -- id=1812
UPDATE product SET productName = 'HDS/W27/001', productDescription = '', productCatId = '140', productBuyPrice = '580', productSellAllPrice = '580', productSellUnitPrice = '580', productSellHalfPrice = '580', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01812',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '580',lastbuyprice_withDiscount = '580',meanbuyprice = '580',meanbuyprice_withDiscount = '580' , productbuypricereal = '580' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='580',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='580',meanbuyprice_withTax='580',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='580',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1812';
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', '1812', '1.00', '2026-10-09', '1', '0','0181201','580','580','580','580','','0','0','0','0','0','0','0','0','0','0'); -- id=1812
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1812', '1', '0', '1', '2026-10-09'); -- id=2826
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1812', '1', '0', '0', '1812', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4206
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1812, 1,'2026-10-09 18:37:13',1)
                ON DUPLICATE KEY UPDATE productid = 1812, edited = 1, sysdate = '2026-10-09 18:37:13', userid = 1; -- id=2732
UPDATE product SET productName = 'HDS/W27/001', productDescription = '', productCatId = '140', productBuyPrice = '580.00', productSellAllPrice = '580.00', productSellUnitPrice = '580.00', productSellHalfPrice = '580.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01812',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '580',lastbuyprice_withDiscount = '580',meanbuyprice = '580',meanbuyprice_withDiscount = '580' , productbuypricereal = '580' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='580',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='580',meanbuyprice_withTax='580',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='580',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1812';
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 ('RA/W27/001','','140','510','510','510','510','2026-10-09','0','1','0','','0','0','0','0','0','510','510','510','510','510','0','0','0','0','.','0','0','0','510','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','510','510','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','510','0','0','0','0','0','0','','','0','0','0','0'); -- id=1813
UPDATE product SET productName = 'RA/W27/001', productDescription = '', productCatId = '140', productBuyPrice = '510', productSellAllPrice = '510', productSellUnitPrice = '510', productSellHalfPrice = '510', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01813',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '510',meanbuyprice = '510',meanbuyprice_withDiscount = '510' , productbuypricereal = '510' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='510',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='510',meanbuyprice_withTax='510',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='510',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1813';
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', '1813', '1.00', '2026-10-09', '1', '0','0181301','510','510','510','510','','0','0','0','0','0','0','0','0','0','0'); -- id=1813
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1813', '1', '0', '1', '2026-10-09'); -- id=2827
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1813', '1', '0', '0', '1813', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4207
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1813, 1,'2026-10-09 18:37:13',1)
                ON DUPLICATE KEY UPDATE productid = 1813, edited = 1, sysdate = '2026-10-09 18:37:13', userid = 1; -- id=2733
UPDATE product SET productName = 'RA/W27/001', productDescription = '', productCatId = '140', productBuyPrice = '510.00', productSellAllPrice = '510.00', productSellUnitPrice = '510.00', productSellHalfPrice = '510.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01813',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '510',meanbuyprice = '510',meanbuyprice_withDiscount = '510' , productbuypricereal = '510' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='510',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='510',meanbuyprice_withTax='510',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='510',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1813';
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 ('RA/W27/005','','140','510','510','510','510','2026-10-09','0','1','0','','0','0','0','0','0','510','510','510','510','510','0','0','0','0','.','0','0','0','510','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','510','510','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','510','0','0','0','0','0','0','','','0','0','0','0'); -- id=1814
UPDATE product SET productName = 'RA/W27/005', productDescription = '', productCatId = '140', productBuyPrice = '510', productSellAllPrice = '510', productSellUnitPrice = '510', productSellHalfPrice = '510', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01814',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '510',meanbuyprice = '510',meanbuyprice_withDiscount = '510' , productbuypricereal = '510' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='510',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='510',meanbuyprice_withTax='510',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='510',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1814';
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', '1814', '1.00', '2026-10-09', '1', '0','0181401','510','510','510','510','','0','0','0','0','0','0','0','0','0','0'); -- id=1814
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1814', '1', '0', '1', '2026-10-09'); -- id=2828
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1814', '1', '0', '0', '1814', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4208
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1814, 1,'2026-10-09 18:37:13',1)
                ON DUPLICATE KEY UPDATE productid = 1814, edited = 1, sysdate = '2026-10-09 18:37:13', userid = 1; -- id=2734
UPDATE product SET productName = 'RA/W27/005', productDescription = '', productCatId = '140', productBuyPrice = '510.00', productSellAllPrice = '510.00', productSellUnitPrice = '510.00', productSellHalfPrice = '510.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01814',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '510',meanbuyprice = '510',meanbuyprice_withDiscount = '510' , productbuypricereal = '510' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='510',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='510',meanbuyprice_withTax='510',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='510',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1814';
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 ('RA/W27/004','','140','450','450','450','450','2026-10-09','0','1','0','','0','0','0','0','0','450','450','450','450','450','0','0','0','0','.','0','0','0','450','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','450','450','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','450','0','0','0','0','0','0','','','0','0','0','0'); -- id=1815
UPDATE product SET productName = 'RA/W27/004', productDescription = '', productCatId = '140', productBuyPrice = '450', productSellAllPrice = '450', productSellUnitPrice = '450', productSellHalfPrice = '450', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01815',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='450',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='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1815';
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', '1815', '1.00', '2026-10-09', '1', '0','0181501','450','450','450','450','','0','0','0','0','0','0','0','0','0','0'); -- id=1815
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1815', '1', '0', '1', '2026-10-09'); -- id=2829
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1815', '1', '0', '0', '1815', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4209
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1815, 1,'2026-10-09 18:37:13',1)
                ON DUPLICATE KEY UPDATE productid = 1815, edited = 1, sysdate = '2026-10-09 18:37:13', userid = 1; -- id=2735
UPDATE product SET productName = 'RA/W27/004', productDescription = '', productCatId = '140', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01815',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='450',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='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1815';
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 ('RA/W27/008','','140','510','510','510','510','2026-10-09','0','1','0','','0','0','0','0','0','510','510','510','510','510','0','0','0','0','.','0','0','0','510','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','510','510','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','510','0','0','0','0','0','0','','','0','0','0','0'); -- id=1816
UPDATE product SET productName = 'RA/W27/008', productDescription = '', productCatId = '140', productBuyPrice = '510', productSellAllPrice = '510', productSellUnitPrice = '510', productSellHalfPrice = '510', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01816',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '510',meanbuyprice = '510',meanbuyprice_withDiscount = '510' , productbuypricereal = '510' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='510',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='510',meanbuyprice_withTax='510',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='510',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1816';
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', '1816', '1.00', '2026-10-09', '1', '0','0181601','510','510','510','510','','0','0','0','0','0','0','0','0','0','0'); -- id=1816
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1816', '1', '0', '1', '2026-10-09'); -- id=2830
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1816', '1', '0', '0', '1816', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4210
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1816, 1,'2026-10-09 18:37:13',1)
                ON DUPLICATE KEY UPDATE productid = 1816, edited = 1, sysdate = '2026-10-09 18:37:13', userid = 1; -- id=2736
UPDATE product SET productName = 'RA/W27/008', productDescription = '', productCatId = '140', productBuyPrice = '510.00', productSellAllPrice = '510.00', productSellUnitPrice = '510.00', productSellHalfPrice = '510.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01816',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '510',meanbuyprice = '510',meanbuyprice_withDiscount = '510' , productbuypricereal = '510' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='510',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='510',meanbuyprice_withTax='510',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='510',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1816';
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 ('HD/W27/001','','140','520','520','520','520','2026-10-09','0','1','0','','0','0','0','0','0','520','520','520','520','520','0','0','0','0','.','0','0','0','520','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','520','520','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','520','0','0','0','0','0','0','','','0','0','0','0'); -- id=1817
UPDATE product SET productName = 'HD/W27/001', productDescription = '', productCatId = '140', productBuyPrice = '520', productSellAllPrice = '520', productSellUnitPrice = '520', productSellHalfPrice = '520', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01817',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '520',lastbuyprice_withDiscount = '520',meanbuyprice = '520',meanbuyprice_withDiscount = '520' , productbuypricereal = '520' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='520',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='520',meanbuyprice_withTax='520',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='520',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1817';
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', '1817', '1.00', '2026-10-09', '1', '0','0181701','520','520','520','520','','0','0','0','0','0','0','0','0','0','0'); -- id=1817
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1817', '1', '0', '1', '2026-10-09'); -- id=2831
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1817', '1', '0', '0', '1817', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4211
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1817, 1,'2026-10-09 18:37:13',1)
                ON DUPLICATE KEY UPDATE productid = 1817, edited = 1, sysdate = '2026-10-09 18:37:13', userid = 1; -- id=2737
UPDATE product SET productName = 'HD/W27/001', productDescription = '', productCatId = '140', productBuyPrice = '520.00', productSellAllPrice = '520.00', productSellUnitPrice = '520.00', productSellHalfPrice = '520.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01817',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '520',lastbuyprice_withDiscount = '520',meanbuyprice = '520',meanbuyprice_withDiscount = '520' , productbuypricereal = '520' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='520',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='520',meanbuyprice_withTax='520',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='520',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1817';
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 ('HDF/W27/004','','140','650','650','650','650','2026-10-09','0','1','0','','0','0','0','0','0','650','650','650','650','650','0','0','0','0','.','0','0','0','650','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','650','650','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','650','0','0','0','0','0','0','','','0','0','0','0'); -- id=1818
UPDATE product SET productName = 'HDF/W27/004', productDescription = '', productCatId = '140', productBuyPrice = '650', productSellAllPrice = '650', productSellUnitPrice = '650', productSellHalfPrice = '650', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01818',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '650',meanbuyprice = '650',meanbuyprice_withDiscount = '650' , productbuypricereal = '650' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='650',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='650',meanbuyprice_withTax='650',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='650',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1818';
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', '1818', '1.00', '2026-10-09', '1', '0','0181801','650','650','650','650','','0','0','0','0','0','0','0','0','0','0'); -- id=1818
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1818', '1', '0', '1', '2026-10-09'); -- id=2832
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1818', '1', '0', '0', '1818', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4212
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1818, 1,'2026-10-09 18:37:13',1)
                ON DUPLICATE KEY UPDATE productid = 1818, edited = 1, sysdate = '2026-10-09 18:37:13', userid = 1; -- id=2738
UPDATE product SET productName = 'HDF/W27/004', productDescription = '', productCatId = '140', productBuyPrice = '650.00', productSellAllPrice = '650.00', productSellUnitPrice = '650.00', productSellHalfPrice = '650.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01818',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '650',meanbuyprice = '650',meanbuyprice_withDiscount = '650' , productbuypricereal = '650' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='650',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='650',meanbuyprice_withTax='650',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='650',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1818';
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 ('HDF/W27/001','','140','650','650','650','650','2026-10-09','0','1','0','','0','0','0','0','0','650','650','650','650','650','0','0','0','0','.','0','0','0','650','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','650','650','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','650','0','0','0','0','0','0','','','0','0','0','0'); -- id=1819
UPDATE product SET productName = 'HDF/W27/001', productDescription = '', productCatId = '140', productBuyPrice = '650', productSellAllPrice = '650', productSellUnitPrice = '650', productSellHalfPrice = '650', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01819',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '650',meanbuyprice = '650',meanbuyprice_withDiscount = '650' , productbuypricereal = '650' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='650',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='650',meanbuyprice_withTax='650',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='650',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1819';
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', '1819', '1.00', '2026-10-09', '1', '0','0181901','650','650','650','650','','0','0','0','0','0','0','0','0','0','0'); -- id=1819
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1819', '1', '0', '1', '2026-10-09'); -- id=2833
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1819', '1', '0', '0', '1819', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4213
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1819, 1,'2026-10-09 18:37:13',1)
                ON DUPLICATE KEY UPDATE productid = 1819, edited = 1, sysdate = '2026-10-09 18:37:13', userid = 1; -- id=2739
UPDATE product SET productName = 'HDF/W27/001', productDescription = '', productCatId = '140', productBuyPrice = '650.00', productSellAllPrice = '650.00', productSellUnitPrice = '650.00', productSellHalfPrice = '650.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01819',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '650',meanbuyprice = '650',meanbuyprice_withDiscount = '650' , productbuypricereal = '650' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='650',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='650',meanbuyprice_withTax='650',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='650',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1819';
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 ('RA/W27/007','','140','530','530','530','530','2026-10-09','0','1','0','','0','0','0','0','0','530','530','530','530','530','0','0','0','0','.','0','0','0','530','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','530','530','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','530','0','0','0','0','0','0','','','0','0','0','0'); -- id=1820
UPDATE product SET productName = 'RA/W27/007', productDescription = '', productCatId = '140', productBuyPrice = '530', productSellAllPrice = '530', productSellUnitPrice = '530', productSellHalfPrice = '530', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01820',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '530',lastbuyprice_withDiscount = '530',meanbuyprice = '530',meanbuyprice_withDiscount = '530' , productbuypricereal = '530' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='530',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='530',meanbuyprice_withTax='530',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='530',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1820';
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', '1820', '1.00', '2026-10-09', '1', '0','0182001','530','530','530','530','','0','0','0','0','0','0','0','0','0','0'); -- id=1820
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1820', '1', '0', '1', '2026-10-09'); -- id=2834
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1820', '1', '0', '0', '1820', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4214
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1820, 1,'2026-10-09 18:37:13',1)
                ON DUPLICATE KEY UPDATE productid = 1820, edited = 1, sysdate = '2026-10-09 18:37:13', userid = 1; -- id=2740
UPDATE product SET productName = 'RA/W27/007', productDescription = '', productCatId = '140', productBuyPrice = '530.00', productSellAllPrice = '530.00', productSellUnitPrice = '530.00', productSellHalfPrice = '530.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01820',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '530',lastbuyprice_withDiscount = '530',meanbuyprice = '530',meanbuyprice_withDiscount = '530' , productbuypricereal = '530' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='530',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='530',meanbuyprice_withTax='530',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='530',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1820';
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 ('RA/W27/009','','140','510','510','510','510','2026-10-09','0','1','0','','0','0','0','0','0','510','510','510','510','510','0','0','0','0','.','0','0','0','510','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','510','510','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','510','0','0','0','0','0','0','','','0','0','0','0'); -- id=1821
UPDATE product SET productName = 'RA/W27/009', productDescription = '', productCatId = '140', productBuyPrice = '510', productSellAllPrice = '510', productSellUnitPrice = '510', productSellHalfPrice = '510', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01821',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '510',meanbuyprice = '510',meanbuyprice_withDiscount = '510' , productbuypricereal = '510' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='510',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='510',meanbuyprice_withTax='510',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='510',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1821';
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', '1821', '1.00', '2026-10-09', '1', '0','0182101','510','510','510','510','','0','0','0','0','0','0','0','0','0','0'); -- id=1821
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1821', '1', '0', '1', '2026-10-09'); -- id=2835
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1821', '1', '0', '0', '1821', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4215
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1821, 1,'2026-10-09 18:37:13',1)
                ON DUPLICATE KEY UPDATE productid = 1821, edited = 1, sysdate = '2026-10-09 18:37:13', userid = 1; -- id=2741
UPDATE product SET productName = 'RA/W27/009', productDescription = '', productCatId = '140', productBuyPrice = '510.00', productSellAllPrice = '510.00', productSellUnitPrice = '510.00', productSellHalfPrice = '510.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01821',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '510',meanbuyprice = '510',meanbuyprice_withDiscount = '510' , productbuypricereal = '510' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='510',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='510',meanbuyprice_withTax='510',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='510',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1821';
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 ('RA/W27/010','','140','550','550','550','550','2026-10-09','0','1','0','','0','0','0','0','0','550','550','550','550','550','0','0','0','0','.','0','0','0','550','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','550','550','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','550','0','0','0','0','0','0','','','0','0','0','0'); -- id=1822
UPDATE product SET productName = 'RA/W27/010', productDescription = '', productCatId = '140', productBuyPrice = '550', productSellAllPrice = '550', productSellUnitPrice = '550', productSellHalfPrice = '550', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01822',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '550',meanbuyprice = '550',meanbuyprice_withDiscount = '550' , productbuypricereal = '550' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',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='550',meanbuyprice_withTax='550',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='550',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1822';
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', '1822', '1.00', '2026-10-09', '1', '0','0182201','550','550','550','550','','0','0','0','0','0','0','0','0','0','0'); -- id=1822
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1822', '1', '0', '1', '2026-10-09'); -- id=2836
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1822', '1', '0', '0', '1822', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4216
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1822, 1,'2026-10-09 18:37:13',1)
                ON DUPLICATE KEY UPDATE productid = 1822, edited = 1, sysdate = '2026-10-09 18:37:13', userid = 1; -- id=2742
UPDATE product SET productName = 'RA/W27/010', productDescription = '', productCatId = '140', productBuyPrice = '550.00', productSellAllPrice = '550.00', productSellUnitPrice = '550.00', productSellHalfPrice = '550.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01822',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '550',meanbuyprice = '550',meanbuyprice_withDiscount = '550' , productbuypricereal = '550' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',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='550',meanbuyprice_withTax='550',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='550',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1822';
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 ('HDF/W27/003','','140','650','650','650','650','2026-10-09','0','1','0','','0','0','0','0','0','650','650','650','650','650','0','0','0','0','.','0','0','0','650','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','650','650','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','650','0','0','0','0','0','0','','','0','0','0','0'); -- id=1823
UPDATE product SET productName = 'HDF/W27/003', productDescription = '', productCatId = '140', productBuyPrice = '650', productSellAllPrice = '650', productSellUnitPrice = '650', productSellHalfPrice = '650', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01823',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '650',meanbuyprice = '650',meanbuyprice_withDiscount = '650' , productbuypricereal = '650' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='650',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='650',meanbuyprice_withTax='650',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='650',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1823';
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', '1823', '1.00', '2026-10-09', '1', '0','0182301','650','650','650','650','','0','0','0','0','0','0','0','0','0','0'); -- id=1823
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1823', '1', '0', '1', '2026-10-09'); -- id=2837
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1823', '1', '0', '0', '1823', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4217
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1823, 1,'2026-10-09 18:37:13',1)
                ON DUPLICATE KEY UPDATE productid = 1823, edited = 1, sysdate = '2026-10-09 18:37:13', userid = 1; -- id=2743
UPDATE product SET productName = 'HDF/W27/003', productDescription = '', productCatId = '140', productBuyPrice = '650.00', productSellAllPrice = '650.00', productSellUnitPrice = '650.00', productSellHalfPrice = '650.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01823',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '650',meanbuyprice = '650',meanbuyprice_withDiscount = '650' , productbuypricereal = '650' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='650',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='650',meanbuyprice_withTax='650',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='650',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1823';
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 ('RAF/W27/002','','140','550','550','550','550','2026-10-09','0','1','0','','0','0','0','0','0','550','550','550','550','550','0','0','0','0','.','0','0','0','550','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','550','550','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','550','0','0','0','0','0','0','','','0','0','0','0'); -- id=1824
UPDATE product SET productName = 'RAF/W27/002', productDescription = '', productCatId = '140', productBuyPrice = '550', productSellAllPrice = '550', productSellUnitPrice = '550', productSellHalfPrice = '550', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01824',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '550',meanbuyprice = '550',meanbuyprice_withDiscount = '550' , productbuypricereal = '550' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',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='550',meanbuyprice_withTax='550',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='550',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1824';
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', '1824', '1.00', '2026-10-09', '1', '0','0182401','550','550','550','550','','0','0','0','0','0','0','0','0','0','0'); -- id=1824
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1824', '1', '0', '1', '2026-10-09'); -- id=2838
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1824', '1', '0', '0', '1824', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4218
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1824, 1,'2026-10-09 18:37:13',1)
                ON DUPLICATE KEY UPDATE productid = 1824, edited = 1, sysdate = '2026-10-09 18:37:13', userid = 1; -- id=2744
UPDATE product SET productName = 'RAF/W27/002', productDescription = '', productCatId = '140', productBuyPrice = '550.00', productSellAllPrice = '550.00', productSellUnitPrice = '550.00', productSellHalfPrice = '550.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01824',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '550',meanbuyprice = '550',meanbuyprice_withDiscount = '550' , productbuypricereal = '550' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',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='550',meanbuyprice_withTax='550',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='550',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1824';
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 ('RA/W27/002','','140','510','510','510','510','2026-10-09','0','1','0','','0','0','0','0','0','510','510','510','510','510','0','0','0','0','.','0','0','0','510','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','510','510','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','510','0','0','0','0','0','0','','','0','0','0','0'); -- id=1825
UPDATE product SET productName = 'RA/W27/002', productDescription = '', productCatId = '140', productBuyPrice = '510', productSellAllPrice = '510', productSellUnitPrice = '510', productSellHalfPrice = '510', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01825',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '510',meanbuyprice = '510',meanbuyprice_withDiscount = '510' , productbuypricereal = '510' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='510',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='510',meanbuyprice_withTax='510',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='510',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1825';
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', '1825', '1.00', '2026-10-09', '1', '0','0182501','510','510','510','510','','0','0','0','0','0','0','0','0','0','0'); -- id=1825
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1825', '1', '0', '1', '2026-10-09'); -- id=2839
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1825', '1', '0', '0', '1825', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-09','0','0'); -- id=4219
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1825, 1,'2026-10-09 18:37:13',1)
                ON DUPLICATE KEY UPDATE productid = 1825, edited = 1, sysdate = '2026-10-09 18:37:13', userid = 1; -- id=2745
UPDATE product SET productName = 'RA/W27/002', productDescription = '', productCatId = '140', productBuyPrice = '510.00', productSellAllPrice = '510.00', productSellUnitPrice = '510.00', productSellHalfPrice = '510.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01825',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '510',meanbuyprice = '510',meanbuyprice_withDiscount = '510' , productbuypricereal = '510' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='510',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='510',meanbuyprice_withTax='510',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='510',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1825';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:07:14";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:37:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 18:37:14', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=6353
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:07:17";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:37:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 18:37:17', '1', 'bill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6354
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('دبل اس', '', '', '', '', '0', '1', '2026-10-09 18:37:50', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=136
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 ('136', '0', '', '0', 'إضافة مورد جديد', '136', '', '2026-10-09 18:37:50', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=299
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('دبل اس', 'دبل اس', 'دبل اس', 'دبل اس', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 18:37:50'); -- id=619
UPDATE supplier SET suppliername = 'دبل اس', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='619',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '136';
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:12:39";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:42:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 18:42:40', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6355
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:12:40";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 18:42:40', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6356
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:13:01";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:43:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventorybybarcodeController.php', '2026-10-09 18:43:01', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventorybybarcodeController.php'); -- id=6357
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:13:16";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:43:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-09 18:43:16', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventoryController.php?do=add'); -- id=6358
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '926';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('926', '1', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '9', '10', '1', '2026-10-09','0','0'); -- id=4220
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '520', '520', '2026-10-09', '1', '0', '0', '2026-10-09 18:43:16','اعادة جرد للمنتج : (فولكانو جينز 1294/فولكانو جينز) فى مخزن : (المخزن الرئيسي) بالكمية : 10','1','0',null,'0','4220','inventoryController.php?do=details&id=4220'); -- id=1870
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1870', '382', '520', '','0'); -- id=1903
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20426177.03', 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 ('1870', '188', '520', '','0'); -- id=1870
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-3230500', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:13:18";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:43:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventorybybarcodeController.php', '2026-10-09 18:43:18', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventorybybarcodeController.php'); -- id=6359
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:13:25";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:43:25", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 18:43:25', '2', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6360
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:13:25";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 18:43:25", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 18:43:25', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6361
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:13:27";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:43:27", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:43:27', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6362
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:13:36";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:43:36", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:43:36', '2', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6363

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac90766def0e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 18:43:36', '06ac90766def0e', '1', '0.00', '0', '0', '1', '75530.00', '75530', '75530', '0', '1', '2026-10-09 18:43:36', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '181' ,'0','','','','','-1','0','0','0','0','0','75530','0','','0','0','75530','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=363
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','363', '0', '2026-10-09 18:43:36', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '75530', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 18:43:36','0','0','',''); -- id=472
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+25 where id = 491;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('390','09673', '363', '20', '850', '25', '390', '9750', '0', '', '0', '2026-10-09 18:43:36', '850', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','491-25,','1','1','0','0','390','9750','0','','0','0.00','0','0','0','0'); -- id=1252
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 392.66, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 392.66
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 392.66, lastbuyprice_withDiscountAndTax = 390
                where sellbilldetailid = 1252;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (850, '2026-10-09', 9750, 9375, 9750
                    , 9816.5, 9750, 9816.5, 9750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 9750, 9816.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9750, sellCostBuyPrice =sellCostBuyPrice+9375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9816.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9816.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9816.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 9750, 9375, 9750
                    , 9816.5, 9750, 9816.5, 9750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9750, 9816.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9750, sellCostBuyPrice =sellCostBuyPrice+9375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9816.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9816.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9816.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 = '125', userid = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '850';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('850', '1', '25', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '150', '125', '2', '2026-10-09 18:43:36','0','0'); -- id=4221
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 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 ('535','01346', '363', '31', '1346', '6', '555', '3330', '0', '', '0', '2026-10-09 18:43:36', '1346', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','38-6,','1','1','0','0','555','3330','0','','0','0.00','0','0','0','0'); -- id=1253
UPDATE sellbilldetail SET  lastbuyprice = 535.00 , meanbuyprice = 535.00, lastbuyprice_withDiscount = 535.00, meanbuyprice_withDiscount = 535.00
        , lastbuyprice_withTax = 535, meanbuyprice_withTax = 535, lastbuyprice_withDiscountAndTax = 535
                where sellbilldetailid = 1253;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1346, '2026-10-09', 3330, 3210, 3210
                    , 3210, 3210, 3210, 3210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3210, 3210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3330, sellCostBuyPrice =sellCostBuyPrice+3210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3210
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3330, 3210, 3210
                    , 3210, 3210, 3210, 3210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3210, 3210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3330, sellCostBuyPrice =sellCostBuyPrice+3210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3210
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '1346';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1346', '1', '6', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '12', '2', '2026-10-09 18:43:36','0','0'); -- id=4222
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','07264', '363', '30', '971', '5', '380', '1900', '0', '', '0', '2026-10-09 18:43:36', '971', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','380','1900','0','','0','0.00','0','0','0','0'); -- id=1254
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1254;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (971, '2026-10-09', 1900, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1900, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1900, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1900, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '971';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('971', '1', '5', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '15', '2', '2026-10-09 18:43:36','0','0'); -- id=4223
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('375','08663', '363', '30', '964', '5', '395', '1975', '0', '', '0', '2026-10-09 18:43:36', '964', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','395','1975','0','','0','0.00','0','0','0','0'); -- id=1255
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 1255;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (964, '2026-10-09', 1975, 1875, 1875
                    , 1875, 1875, 1875, 1875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1875, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1975, sellCostBuyPrice =sellCostBuyPrice+1875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1975, 1875, 1875
                    , 1875, 1875, 1875, 1875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1875, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1975, sellCostBuyPrice =sellCostBuyPrice+1875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '964';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('964', '1', '5', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '65', '60', '2', '2026-10-09 18:43:36','0','0'); -- id=4224
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 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 ('375','01321', '363', '39', '1321', '10', '400', '4000', '0', '', '0', '2026-10-09 18:43:36', '1321', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','5-5,','1','1','0','0','400','4000','0','','0','0.00','0','0','0','0'); -- id=1256
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 187.5, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 1256;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1321, '2026-10-09', 4000, 3750, 3750
                    , 3750, 3750, 3750, 3750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 3750, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4000, sellCostBuyPrice =sellCostBuyPrice+3750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4000, 3750, 3750
                    , 3750, 3750, 3750, 3750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3750, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4000, sellCostBuyPrice =sellCostBuyPrice+3750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '1321';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1321', '1', '10', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '0', '2', '2026-10-09 18:43:36','0','0'); -- id=4225
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 32;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','01327', '363', '37', '1327', '10', '480', '4800', '0', '', '0', '2026-10-09 18:43:36', '1327', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','32-10,','1','1','0','0','480','4800','0','','0','0.00','0','0','0','0'); -- id=1257
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 1257;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1327, '2026-10-09', 4800, 4600, 4600
                    , 4600, 4600, 4600, 4600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 4600, 4600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4800, sellCostBuyPrice =sellCostBuyPrice+4600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4800, 4600, 4600
                    , 4600, 4600, 4600, 4600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4600, 4600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4800, sellCostBuyPrice =sellCostBuyPrice+4600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '25', userid = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '1327';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1327', '1', '10', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '35', '25', '2', '2026-10-09 18:43:36','0','0'); -- id=4226
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('520','08851', '363', '28', '926', '10', '540', '5400', '0', '', '0', '2026-10-09 18:43:36', '926', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','540','5400','0','','0','0.00','0','0','0','0'); -- id=1258
UPDATE sellbilldetail SET  lastbuyprice = 520.00 , meanbuyprice = 520.00, lastbuyprice_withDiscount = 520.00, meanbuyprice_withDiscount = 520.00
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 520
                where sellbilldetailid = 1258;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (926, '2026-10-09', 5400, 5200, 5200
                    , 5200, 5200, 5200, 5200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 5200, 5200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5400, sellCostBuyPrice =sellCostBuyPrice+5200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5400, 5200, 5200
                    , 5200, 5200, 5200, 5200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5200, 5200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5400, sellCostBuyPrice =sellCostBuyPrice+5200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '926';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('926', '1', '10', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '0', '2', '2026-10-09 18:43:36','0','0'); -- id=4227
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 69;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('530','01354', '363', '26', '1354', '5', '550', '2750', '0', '', '0', '2026-10-09 18:43:36', '1354', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','69-5,','1','1','0','0','550','2750','0','','0','0.00','0','0','0','0'); -- id=1259
UPDATE sellbilldetail SET  lastbuyprice = 530.00 , meanbuyprice = 530.00, lastbuyprice_withDiscount = 530.00, meanbuyprice_withDiscount = 530.00
        , lastbuyprice_withTax = 530, meanbuyprice_withTax = 530, lastbuyprice_withDiscountAndTax = 530
                where sellbilldetailid = 1259;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1354, '2026-10-09', 2750, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2750, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2750, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2750, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '40', userid = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '1354';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1354', '1', '5', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '45', '40', '2', '2026-10-09 18:43:36','0','0'); -- id=4228
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('375','08409', '363', '32', '1022', '15', '395', '5925', '0', '', '0', '2026-10-09 18:43:36', '1022', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','395','5925','0','','0','0.00','0','0','0','0'); -- id=1260
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 1260;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1022, '2026-10-09', 5925, 5625, 5625
                    , 5625, 5625, 5625, 5625
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 5625, 5625, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5925, sellCostBuyPrice =sellCostBuyPrice+5625
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5625, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5625
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5625, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5625
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5625
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5625
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5625
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-10-09', 5925, 5625, 5625
                    , 5625, 5625, 5625, 5625
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5625, 5625, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5925, sellCostBuyPrice =sellCostBuyPrice+5625
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5625, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5625
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5625, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5625
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5625
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5625
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5625
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '14', userid = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '1022';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1022', '1', '15', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '29', '14', '2', '2026-10-09 18:43:36','0','0'); -- id=4229
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('375','09746', '363', '29', '961', '5', '395', '1975', '0', '', '0', '2026-10-09 18:43:36', '961', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','395','1975','0','','0','0.00','0','0','0','0'); -- id=1261
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 1261;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (961, '2026-10-09', 1975, 1875, 1875
                    , 1875, 1875, 1875, 1875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1875, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1975, sellCostBuyPrice =sellCostBuyPrice+1875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1975, 1875, 1875
                    , 1875, 1875, 1875, 1875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1875, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1975, sellCostBuyPrice =sellCostBuyPrice+1875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '961';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('961', '1', '5', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '15', '2', '2026-10-09 18:43:36','0','0'); -- id=4230
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('530','09828', '363', '5', '660', '5', '550', '2750', '0', '', '0', '2026-10-09 18:43:36', '660', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','550','2750','0','','0','0.00','0','0','0','0'); -- id=1262
UPDATE sellbilldetail SET  lastbuyprice = 530.00 , meanbuyprice = 530.00, lastbuyprice_withDiscount = 530.00, meanbuyprice_withDiscount = 530.00
        , lastbuyprice_withTax = 530, meanbuyprice_withTax = 530, lastbuyprice_withDiscountAndTax = 530
                where sellbilldetailid = 1262;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (660, '2026-10-09', 2750, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2750, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2750, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2750, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '35', userid = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '660';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('660', '1', '5', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '40', '35', '2', '2026-10-09 18:43:36','0','0'); -- id=4231
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('375','05207', '363', '10', '764', '10', '395', '3950', '0', '', '0', '2026-10-09 18:43:36', '764', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','395','3950','0','','0','0.00','0','0','0','0'); -- id=1263
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 1263;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (764, '2026-10-09', 3950, 3750, 3750
                    , 3750, 3750, 3750, 3750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 3750, 3750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3950, sellCostBuyPrice =sellCostBuyPrice+3750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3750
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3950, 3750, 3750
                    , 3750, 3750, 3750, 3750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3750, 3750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3950, sellCostBuyPrice =sellCostBuyPrice+3750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3750
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '764';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('764', '1', '10', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '70', '60', '2', '2026-10-09 18:43:36','0','0'); -- id=4232
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('570','09752', '363', '28', '950', '5', '590', '2950', '0', '', '0', '2026-10-09 18:43:36', '950', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','590','2950','0','','0','0.00','0','0','0','0'); -- id=1264
UPDATE sellbilldetail SET  lastbuyprice = 570.00 , meanbuyprice = 570.00, lastbuyprice_withDiscount = 570.00, meanbuyprice_withDiscount = 570.00
        , lastbuyprice_withTax = 570, meanbuyprice_withTax = 570, lastbuyprice_withDiscountAndTax = 570
                where sellbilldetailid = 1264;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (950, '2026-10-09', 2950, 2850, 2850
                    , 2850, 2850, 2850, 2850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2950, sellCostBuyPrice =sellCostBuyPrice+2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2950, 2850, 2850
                    , 2850, 2850, 2850, 2850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2950, sellCostBuyPrice =sellCostBuyPrice+2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '5', userid = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '950';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('950', '1', '5', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '5', '2', '2026-10-09 18:43:36','0','0'); -- id=4233
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','00358', '363', '18', '817', '5', '290', '1450', '0', '', '0', '2026-10-09 18:43:36', '817', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','290','1450','0','','0','0.00','0','0','0','0'); -- id=1265
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1265;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (817, '2026-10-09', 1450, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1450, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1450, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1450, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '214', userid = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '817';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('817', '1', '5', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '219', '214', '2', '2026-10-09 18:43:36','0','0'); -- id=4234
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('395','09227', '363', '2', '1002', '5', '415', '2075', '0', '', '0', '2026-10-09 18:43:36', '1002', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','415','2075','0','','0','0.00','0','0','0','0'); -- id=1266
UPDATE sellbilldetail SET  lastbuyprice = 395.00 , meanbuyprice = 395.00, lastbuyprice_withDiscount = 395.00, meanbuyprice_withDiscount = 395.00
        , lastbuyprice_withTax = 395, meanbuyprice_withTax = 395, lastbuyprice_withDiscountAndTax = 395
                where sellbilldetailid = 1266;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1002, '2026-10-09', 2075, 1975, 1975
                    , 1975, 1975, 1975, 1975
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1975, 1975, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2075, sellCostBuyPrice =sellCostBuyPrice+1975
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1975, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1975
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1975, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1975
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1975
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1975
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1975
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2075, 1975, 1975
                    , 1975, 1975, 1975, 1975
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1975, 1975, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2075, sellCostBuyPrice =sellCostBuyPrice+1975
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1975, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1975
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1975, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1975
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1975
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1975
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1975
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '50', userid = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '1002';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1002', '1', '5', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '55', '50', '2', '2026-10-09 18:43:36','0','0'); -- id=4235
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','08633', '363', '31', '978', '5', '380', '1900', '0', '', '0', '2026-10-09 18:43:36', '978', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','380','1900','0','','0','0.00','0','0','0','0'); -- id=1267
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1267;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (978, '2026-10-09', 1900, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1900, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1900, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1900, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '5', userid = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '978';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('978', '1', '5', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '5', '2', '2026-10-09 18:43:36','0','0'); -- id=4236
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('400','09372', '363', '2', '1010', '25', '420', '10500', '0', '', '0', '2026-10-09 18:43:36', '1010', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','420','10500','0','','0','0.00','0','0','0','0'); -- id=1268
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 400.00, meanbuyprice_withDiscount = 400.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 400
                where sellbilldetailid = 1268;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1010, '2026-10-09', 10500, 10000, 10000
                    , 10000, 10000, 10000, 10000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 10000, 10000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10500, sellCostBuyPrice =sellCostBuyPrice+10000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 10500, 10000, 10000
                    , 10000, 10000, 10000, 10000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10000, 10000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10500, sellCostBuyPrice =sellCostBuyPrice+10000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '1010';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1010', '1', '25', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '25', '0', '2', '2026-10-09 18:43:36','0','0'); -- id=4237
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','09633', '363', '24', '886', '10', '380', '3800', '0', '', '0', '2026-10-09 18:43:36', '886', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','380','3800','0','','0','0.00','0','0','0','0'); -- id=1269
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1269;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (886, '2026-10-09', 3800, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3800, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3800, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3800, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '10', userid = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '886';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('886', '1', '10', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '10', '2', '2026-10-09 18:43:36','0','0'); -- id=4238
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','00358', '363', '18', '817', '15', '290', '4350', '0', '', '0', '2026-10-09 18:43:36', '817', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','290','4350','0','','0','0.00','0','0','0','0'); -- id=1270
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1270;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (817, '2026-10-09', 4350, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4350, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-10-09', 4350, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4350, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '199', userid = '2', storedetaildate = '2026-10-09 18:43:36' WHERE storedetailid = '817';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('817', '1', '15', '1', '363', 'اضافة فاتورة مبيعات', 'sellbillController.php', '214', '199', '2', '2026-10-09 18:43:36','0','0'); -- id=4239
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2162258',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('2086728','75530', '0', '2', 'اضافة فاتورة مبيعات', '363', '2162258', '2026-10-09 18:43:36', '2',  'sellbillController.php','1','','0'); -- id=410
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '75530', '75530', '2026-10-09', '2', '0', '0', '2026-10-09 18:43:36','اضافة فاتورة مبيعات رقم 363','1','0',null,'0','363','sellbillController.php?do=showDetail&sellbillid=363'); -- id=1871
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1871', '419', '75530', '','0'); -- id=1904
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '2162255', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1871', '143', '75530', '','0'); -- id=1871
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3762975', 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 ( '72360', '72360', '2026-10-09', '2', '0', '0', '2026-10-09 18:43:36','اضافة فاتورة مبيعات رقم 363 - صرف البضاعة من المخزن','1','0',null,'0','363','sellbillController.php?do=showDetail&sellbillid=363'); -- id=1872
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1872', '402', '72360', '','0'); -- id=1905
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3536324.17', 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 ('1872', '382', '72360', '','0'); -- id=1872
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20353817.03', 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='1871,0,1872' where sellbillid=363;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 75530, 71985, 72360
                    , 72426.5, 72360, 72426.5, 72360
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,72360, 70551.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75530, sellCostBuyPrice =sellCostBuyPrice+71985
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+72360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+72426.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+72360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+72426.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+72360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+72360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+70551.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-10-09', 75530, 71985, 72360
                    , 72426.5, 72360, 72426.5, 72360
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,72360, 70551.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75530, sellCostBuyPrice =sellCostBuyPrice+71985
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+72360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+72426.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+72360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+72426.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+72360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+72360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+70551.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, 75530, 71985, 72360
                    , 72426.5, 72360, 72426.5, 72360, 72360, 70551.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+75530, netSellCostBuyPrice = netSellCostBuyPrice+71985
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+72360
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+72426.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+72360
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+72426.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+72360
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+72360
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+70551.5;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac90766def0e and sellbillId = 363 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:13:36";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:43:36", deviceType = "DESKTOP" WHERE userid = 2;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:13:36";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:43:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:43:36', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6364
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-09 18:43:36', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php'); -- id=6365
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:13:56";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:43:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-09 18:43:56', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php?do=show'); -- id=6366
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:14:50";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:44:50", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:44:50', '2', 'showDetail', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=363'); -- id=6367
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:15:40";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:45:40", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:45:40', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6368
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:15:48";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:45:48", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:45:48', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6369
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:16:07";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:46:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 18:46:07', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=6370
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 ('06ac90a2dad72d', '2026-10-09 18:37:17', '136', '0.00', '118584', '10', '1', '131760.00',  '118584.00', '0', '118584', '1', '2026-10-09 18:46:07', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=100
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 ('01812', '100', '140', '1812', '24', '580', '13920.00', '0', '', '2026-10-09 18:46:07', '1812','','','0','0','0','0','0',null,'580','13920','0','0','0','0','0','0','0','0','1'); -- id=637
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 18:37:17', 1, 1812, 0, 0
                    , 522, 24, 0, 0, 1, '2026-10-09 18:46:07')
                ON DUPLICATE KEY UPDATE buyprice = 522,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 18:46:07' ; -- id=814
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1812', '580', '24', '0', 'buyBillController.php', '637', '', '0', '0'); -- id=503
UPDATE product SET  productBuyPrice = "580" WHERE productId = 1812 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 637 ;
UPDATE product SET productName = 'HDS/W27/001', productDescription = '', productCatId = '140', productBuyPrice = '580.00', productSellAllPrice = '580.00', productSellUnitPrice = '580.00', productSellHalfPrice = '580.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01812',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '580',lastbuyprice_withDiscount = '522',meanbuyprice = '580',meanbuyprice_withDiscount = '522' , productbuypricereal = '580.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='580',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='580',meanbuyprice_withTax='580',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='522',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1812';
UPDATE buybilldetail SET  lastbuyprice = 580 , meanbuyprice = 580, lastbuyprice_withDiscount = 522, meanbuyprice_withDiscount = 522
        , lastbuyprice_withTax = 580, meanbuyprice_withTax = 580, lastbuyprice_withDiscountAndTax = 522
                where buybilldetailid = 637;
UPDATE productunit SET proUnitBuyPrice  = 580 * productnumber WHERE productid = 1812;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2826';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1812', '1', '24', '0', '100', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 18:37:17','0','0'); -- id=4240
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 ('01813', '100', '140', '1813', '16', '510', '8160.00', '0', '', '2026-10-09 18:46:07', '1813','','','0','0','0','0','0',null,'510','8160','0','0','0','0','0','0','0','0','1'); -- id=638
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 18:37:17', 1, 1813, 0, 0
                    , 459, 16, 0, 0, 1, '2026-10-09 18:46:07')
                ON DUPLICATE KEY UPDATE buyprice = 459,
                        buyQuantity =buyQuantity+16, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 18:46:07' ; -- id=815
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1813', '510', '16', '0', 'buyBillController.php', '638', '', '0', '0'); -- id=504
UPDATE product SET  productBuyPrice = "510" WHERE productId = 1813 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 638 ;
UPDATE product SET productName = 'RA/W27/001', productDescription = '', productCatId = '140', productBuyPrice = '510.00', productSellAllPrice = '510.00', productSellUnitPrice = '510.00', productSellHalfPrice = '510.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01813',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '459',meanbuyprice = '510',meanbuyprice_withDiscount = '459' , productbuypricereal = '510.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='510',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='510',meanbuyprice_withTax='510',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='459',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1813';
UPDATE buybilldetail SET  lastbuyprice = 510 , meanbuyprice = 510, lastbuyprice_withDiscount = 459, meanbuyprice_withDiscount = 459
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 459
                where buybilldetailid = 638;
UPDATE productunit SET proUnitBuyPrice  = 510 * productnumber WHERE productid = 1813;
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2827';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1813', '1', '16', '0', '100', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '16', '1', '2026-10-09 18:37:17','0','0'); -- id=4241
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 ('01814', '100', '140', '1814', '12', '510', '6120.00', '0', '', '2026-10-09 18:46:07', '1814','','','0','0','0','0','0',null,'510','6120','0','0','0','0','0','0','0','0','1'); -- id=639
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 18:37:17', 1, 1814, 0, 0
                    , 459, 12, 0, 0, 1, '2026-10-09 18:46:07')
                ON DUPLICATE KEY UPDATE buyprice = 459,
                        buyQuantity =buyQuantity+12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 18:46:07' ; -- id=816
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1814', '510', '12', '0', 'buyBillController.php', '639', '', '0', '0'); -- id=505
UPDATE product SET  productBuyPrice = "510" WHERE productId = 1814 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 639 ;
UPDATE product SET productName = 'RA/W27/005', productDescription = '', productCatId = '140', productBuyPrice = '510.00', productSellAllPrice = '510.00', productSellUnitPrice = '510.00', productSellHalfPrice = '510.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01814',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '459',meanbuyprice = '510',meanbuyprice_withDiscount = '459' , productbuypricereal = '510.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='510',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='510',meanbuyprice_withTax='510',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='459',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1814';
UPDATE buybilldetail SET  lastbuyprice = 510 , meanbuyprice = 510, lastbuyprice_withDiscount = 459, meanbuyprice_withDiscount = 459
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 459
                where buybilldetailid = 639;
UPDATE productunit SET proUnitBuyPrice  = 510 * productnumber WHERE productid = 1814;
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2828';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1814', '1', '12', '0', '100', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '12', '1', '2026-10-09 18:37:17','0','0'); -- id=4242
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 ('01815', '100', '140', '1815', '24', '450', '10800.00', '0', '', '2026-10-09 18:46:07', '1815','','','0','0','0','0','0',null,'450','10800','0','0','0','0','0','0','0','0','1'); -- id=640
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 18:37:17', 1, 1815, 0, 0
                    , 405, 24, 0, 0, 1, '2026-10-09 18:46:07')
                ON DUPLICATE KEY UPDATE buyprice = 405,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 18:46:07' ; -- id=817
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1815', '450', '24', '0', 'buyBillController.php', '640', '', '0', '0'); -- id=506
UPDATE product SET  productBuyPrice = "450" WHERE productId = 1815 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 640 ;
UPDATE product SET productName = 'RA/W27/004', productDescription = '', productCatId = '140', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01815',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '405',meanbuyprice = '450',meanbuyprice_withDiscount = '405' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='450',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='405',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1815';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 405, meanbuyprice_withDiscount = 405
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 405
                where buybilldetailid = 640;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 1815;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2829';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1815', '1', '24', '0', '100', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 18:37:17','0','0'); -- id=4243
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 ('01816', '100', '140', '1816', '24', '510', '12240.00', '0', '', '2026-10-09 18:46:07', '1816','','','0','0','0','0','0',null,'510','12240','0','0','0','0','0','0','0','0','1'); -- id=641
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 18:37:17', 1, 1816, 0, 0
                    , 459, 24, 0, 0, 1, '2026-10-09 18:46:07')
                ON DUPLICATE KEY UPDATE buyprice = 459,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 18:46:07' ; -- id=818
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1816', '510', '24', '0', 'buyBillController.php', '641', '', '0', '0'); -- id=507
UPDATE product SET  productBuyPrice = "510" WHERE productId = 1816 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 641 ;
UPDATE product SET productName = 'RA/W27/008', productDescription = '', productCatId = '140', productBuyPrice = '510.00', productSellAllPrice = '510.00', productSellUnitPrice = '510.00', productSellHalfPrice = '510.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01816',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '459',meanbuyprice = '510',meanbuyprice_withDiscount = '459' , productbuypricereal = '510.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='510',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='510',meanbuyprice_withTax='510',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='459',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1816';
UPDATE buybilldetail SET  lastbuyprice = 510 , meanbuyprice = 510, lastbuyprice_withDiscount = 459, meanbuyprice_withDiscount = 459
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 459
                where buybilldetailid = 641;
UPDATE productunit SET proUnitBuyPrice  = 510 * productnumber WHERE productid = 1816;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2830';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1816', '1', '24', '0', '100', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 18:37:17','0','0'); -- id=4244
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 ('01817', '100', '140', '1817', '12', '520', '6240.00', '0', '', '2026-10-09 18:46:07', '1817','','','0','0','0','0','0',null,'520','6240','0','0','0','0','0','0','0','0','1'); -- id=642
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 18:37:17', 1, 1817, 0, 0
                    , 468, 12, 0, 0, 1, '2026-10-09 18:46:07')
                ON DUPLICATE KEY UPDATE buyprice = 468,
                        buyQuantity =buyQuantity+12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 18:46:07' ; -- id=819
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1817', '520', '12', '0', 'buyBillController.php', '642', '', '0', '0'); -- id=508
UPDATE product SET  productBuyPrice = "520" WHERE productId = 1817 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 642 ;
UPDATE product SET productName = 'HD/W27/001', productDescription = '', productCatId = '140', productBuyPrice = '520.00', productSellAllPrice = '520.00', productSellUnitPrice = '520.00', productSellHalfPrice = '520.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01817',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '520',lastbuyprice_withDiscount = '468',meanbuyprice = '520',meanbuyprice_withDiscount = '468' , productbuypricereal = '520.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='520',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='520',meanbuyprice_withTax='520',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='468',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1817';
UPDATE buybilldetail SET  lastbuyprice = 520 , meanbuyprice = 520, lastbuyprice_withDiscount = 468, meanbuyprice_withDiscount = 468
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 468
                where buybilldetailid = 642;
UPDATE productunit SET proUnitBuyPrice  = 520 * productnumber WHERE productid = 1817;
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2831';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1817', '1', '12', '0', '100', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '12', '1', '2026-10-09 18:37:17','0','0'); -- id=4245
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 ('01818', '100', '140', '1818', '12', '650', '7800.00', '0', '', '2026-10-09 18:46:07', '1818','','','0','0','0','0','0',null,'650','7800','0','0','0','0','0','0','0','0','1'); -- id=643
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 18:37:17', 1, 1818, 0, 0
                    , 585, 12, 0, 0, 1, '2026-10-09 18:46:07')
                ON DUPLICATE KEY UPDATE buyprice = 585,
                        buyQuantity =buyQuantity+12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 18:46:07' ; -- id=820
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1818', '650', '12', '0', 'buyBillController.php', '643', '', '0', '0'); -- id=509
UPDATE product SET  productBuyPrice = "650" WHERE productId = 1818 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 643 ;
UPDATE product SET productName = 'HDF/W27/004', productDescription = '', productCatId = '140', productBuyPrice = '650.00', productSellAllPrice = '650.00', productSellUnitPrice = '650.00', productSellHalfPrice = '650.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01818',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '585',meanbuyprice = '650',meanbuyprice_withDiscount = '585' , productbuypricereal = '650.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='650',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='650',meanbuyprice_withTax='650',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='585',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1818';
UPDATE buybilldetail SET  lastbuyprice = 650 , meanbuyprice = 650, lastbuyprice_withDiscount = 585, meanbuyprice_withDiscount = 585
        , lastbuyprice_withTax = 650, meanbuyprice_withTax = 650, lastbuyprice_withDiscountAndTax = 585
                where buybilldetailid = 643;
UPDATE productunit SET proUnitBuyPrice  = 650 * productnumber WHERE productid = 1818;
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2832';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1818', '1', '12', '0', '100', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '12', '1', '2026-10-09 18:37:17','0','0'); -- id=4246
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 ('01819', '100', '140', '1819', '12', '650', '7800.00', '0', '', '2026-10-09 18:46:07', '1819','','','0','0','0','0','0',null,'650','7800','0','0','0','0','0','0','0','0','1'); -- id=644
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 18:37:17', 1, 1819, 0, 0
                    , 585, 12, 0, 0, 1, '2026-10-09 18:46:07')
                ON DUPLICATE KEY UPDATE buyprice = 585,
                        buyQuantity =buyQuantity+12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 18:46:07' ; -- id=821
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1819', '650', '12', '0', 'buyBillController.php', '644', '', '0', '0'); -- id=510
UPDATE product SET  productBuyPrice = "650" WHERE productId = 1819 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 644 ;
UPDATE product SET productName = 'HDF/W27/001', productDescription = '', productCatId = '140', productBuyPrice = '650.00', productSellAllPrice = '650.00', productSellUnitPrice = '650.00', productSellHalfPrice = '650.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01819',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '585',meanbuyprice = '650',meanbuyprice_withDiscount = '585' , productbuypricereal = '650.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='650',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='650',meanbuyprice_withTax='650',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='585',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1819';
UPDATE buybilldetail SET  lastbuyprice = 650 , meanbuyprice = 650, lastbuyprice_withDiscount = 585, meanbuyprice_withDiscount = 585
        , lastbuyprice_withTax = 650, meanbuyprice_withTax = 650, lastbuyprice_withDiscountAndTax = 585
                where buybilldetailid = 644;
UPDATE productunit SET proUnitBuyPrice  = 650 * productnumber WHERE productid = 1819;
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2833';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1819', '1', '12', '0', '100', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '12', '1', '2026-10-09 18:37:17','0','0'); -- id=4247
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 ('01820', '100', '140', '1820', '24', '530', '12720.00', '0', '', '2026-10-09 18:46:07', '1820','','','0','0','0','0','0',null,'530','12720','0','0','0','0','0','0','0','0','1'); -- id=645
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 18:37:17', 1, 1820, 0, 0
                    , 477, 24, 0, 0, 1, '2026-10-09 18:46:07')
                ON DUPLICATE KEY UPDATE buyprice = 477,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 18:46:07' ; -- id=822
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1820', '530', '24', '0', 'buyBillController.php', '645', '', '0', '0'); -- id=511
UPDATE product SET  productBuyPrice = "530" WHERE productId = 1820 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 645 ;
UPDATE product SET productName = 'RA/W27/007', productDescription = '', productCatId = '140', productBuyPrice = '530.00', productSellAllPrice = '530.00', productSellUnitPrice = '530.00', productSellHalfPrice = '530.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01820',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '530',lastbuyprice_withDiscount = '477',meanbuyprice = '530',meanbuyprice_withDiscount = '477' , productbuypricereal = '530.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='530',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='530',meanbuyprice_withTax='530',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='477',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1820';
UPDATE buybilldetail SET  lastbuyprice = 530 , meanbuyprice = 530, lastbuyprice_withDiscount = 477, meanbuyprice_withDiscount = 477
        , lastbuyprice_withTax = 530, meanbuyprice_withTax = 530, lastbuyprice_withDiscountAndTax = 477
                where buybilldetailid = 645;
UPDATE productunit SET proUnitBuyPrice  = 530 * productnumber WHERE productid = 1820;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2834';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1820', '1', '24', '0', '100', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 18:37:17','0','0'); -- id=4248
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 ('01821', '100', '140', '1821', '24', '510', '12240.00', '0', '', '2026-10-09 18:46:07', '1821','','','0','0','0','0','0',null,'510','12240','0','0','0','0','0','0','0','0','1'); -- id=646
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 18:37:17', 1, 1821, 0, 0
                    , 459, 24, 0, 0, 1, '2026-10-09 18:46:07')
                ON DUPLICATE KEY UPDATE buyprice = 459,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 18:46:07' ; -- id=823
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1821', '510', '24', '0', 'buyBillController.php', '646', '', '0', '0'); -- id=512
UPDATE product SET  productBuyPrice = "510" WHERE productId = 1821 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 646 ;
UPDATE product SET productName = 'RA/W27/009', productDescription = '', productCatId = '140', productBuyPrice = '510.00', productSellAllPrice = '510.00', productSellUnitPrice = '510.00', productSellHalfPrice = '510.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01821',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '459',meanbuyprice = '510',meanbuyprice_withDiscount = '459' , productbuypricereal = '510.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='510',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='510',meanbuyprice_withTax='510',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='459',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1821';
UPDATE buybilldetail SET  lastbuyprice = 510 , meanbuyprice = 510, lastbuyprice_withDiscount = 459, meanbuyprice_withDiscount = 459
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 459
                where buybilldetailid = 646;
UPDATE productunit SET proUnitBuyPrice  = 510 * productnumber WHERE productid = 1821;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2835';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1821', '1', '24', '0', '100', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 18:37:17','0','0'); -- id=4249
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 ('01822', '100', '140', '1822', '24', '550', '13200.00', '0', '', '2026-10-09 18:46:07', '1822','','','0','0','0','0','0',null,'550','13200','0','0','0','0','0','0','0','0','1'); -- id=647
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 18:37:17', 1, 1822, 0, 0
                    , 495, 24, 0, 0, 1, '2026-10-09 18:46:07')
                ON DUPLICATE KEY UPDATE buyprice = 495,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 18:46:07' ; -- id=824
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1822', '550', '24', '0', 'buyBillController.php', '647', '', '0', '0'); -- id=513
UPDATE product SET  productBuyPrice = "550" WHERE productId = 1822 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 647 ;
UPDATE product SET productName = 'RA/W27/010', productDescription = '', productCatId = '140', productBuyPrice = '550.00', productSellAllPrice = '550.00', productSellUnitPrice = '550.00', productSellHalfPrice = '550.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01822',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '495',meanbuyprice = '550',meanbuyprice_withDiscount = '495' , productbuypricereal = '550.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',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='550',meanbuyprice_withTax='550',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='495',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1822';
UPDATE buybilldetail SET  lastbuyprice = 550 , meanbuyprice = 550, lastbuyprice_withDiscount = 495, meanbuyprice_withDiscount = 495
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 495
                where buybilldetailid = 647;
UPDATE productunit SET proUnitBuyPrice  = 550 * productnumber WHERE productid = 1822;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2836';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1822', '1', '24', '0', '100', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-09 18:37:17','0','0'); -- id=4250
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 ('01823', '100', '140', '1823', '12', '650', '7800.00', '0', '', '2026-10-09 18:46:07', '1823','','','0','0','0','0','0',null,'650','7800','0','0','0','0','0','0','0','0','1'); -- id=648
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 18:37:17', 1, 1823, 0, 0
                    , 585, 12, 0, 0, 1, '2026-10-09 18:46:07')
                ON DUPLICATE KEY UPDATE buyprice = 585,
                        buyQuantity =buyQuantity+12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 18:46:07' ; -- id=825
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1823', '650', '12', '0', 'buyBillController.php', '648', '', '0', '0'); -- id=514
UPDATE product SET  productBuyPrice = "650" WHERE productId = 1823 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 648 ;
UPDATE product SET productName = 'HDF/W27/003', productDescription = '', productCatId = '140', productBuyPrice = '650.00', productSellAllPrice = '650.00', productSellUnitPrice = '650.00', productSellHalfPrice = '650.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01823',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '585',meanbuyprice = '650',meanbuyprice_withDiscount = '585' , productbuypricereal = '650.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='650',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='650',meanbuyprice_withTax='650',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='585',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1823';
UPDATE buybilldetail SET  lastbuyprice = 650 , meanbuyprice = 650, lastbuyprice_withDiscount = 585, meanbuyprice_withDiscount = 585
        , lastbuyprice_withTax = 650, meanbuyprice_withTax = 650, lastbuyprice_withDiscountAndTax = 585
                where buybilldetailid = 648;
UPDATE productunit SET proUnitBuyPrice  = 650 * productnumber WHERE productid = 1823;
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2837';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1823', '1', '12', '0', '100', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '12', '1', '2026-10-09 18:37:17','0','0'); -- id=4251
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 ('01824', '100', '140', '1824', '12', '550', '6600.00', '0', '', '2026-10-09 18:46:07', '1824','','','0','0','0','0','0',null,'550','6600','0','0','0','0','0','0','0','0','1'); -- id=649
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 18:37:17', 1, 1824, 0, 0
                    , 495, 12, 0, 0, 1, '2026-10-09 18:46:07')
                ON DUPLICATE KEY UPDATE buyprice = 495,
                        buyQuantity =buyQuantity+12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 18:46:07' ; -- id=826
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1824', '550', '12', '0', 'buyBillController.php', '649', '', '0', '0'); -- id=515
UPDATE product SET  productBuyPrice = "550" WHERE productId = 1824 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 649 ;
UPDATE product SET productName = 'RAF/W27/002', productDescription = '', productCatId = '140', productBuyPrice = '550.00', productSellAllPrice = '550.00', productSellUnitPrice = '550.00', productSellHalfPrice = '550.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01824',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '495',meanbuyprice = '550',meanbuyprice_withDiscount = '495' , productbuypricereal = '550.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',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='550',meanbuyprice_withTax='550',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='495',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1824';
UPDATE buybilldetail SET  lastbuyprice = 550 , meanbuyprice = 550, lastbuyprice_withDiscount = 495, meanbuyprice_withDiscount = 495
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 495
                where buybilldetailid = 649;
UPDATE productunit SET proUnitBuyPrice  = 550 * productnumber WHERE productid = 1824;
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2838';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1824', '1', '12', '0', '100', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '12', '1', '2026-10-09 18:37:17','0','0'); -- id=4252
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 ('01825', '100', '140', '1825', '12', '510', '6120.00', '0', '', '2026-10-09 18:46:07', '1825','','','0','0','0','0','0',null,'510','6120','0','0','0','0','0','0','0','0','1'); -- id=650
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-09 18:37:17', 1, 1825, 0, 0
                    , 459, 12, 0, 0, 1, '2026-10-09 18:46:07')
                ON DUPLICATE KEY UPDATE buyprice = 459,
                        buyQuantity =buyQuantity+12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-09 18:46:07' ; -- id=827
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1825', '510', '12', '0', 'buyBillController.php', '650', '', '0', '0'); -- id=516
UPDATE product SET  productBuyPrice = "510" WHERE productId = 1825 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 650 ;
UPDATE product SET productName = 'RA/W27/002', productDescription = '', productCatId = '140', productBuyPrice = '510.00', productSellAllPrice = '510.00', productSellUnitPrice = '510.00', productSellHalfPrice = '510.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01825',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '459',meanbuyprice = '510',meanbuyprice_withDiscount = '459' , productbuypricereal = '510.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='510',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='510',meanbuyprice_withTax='510',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='459',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1825';
UPDATE buybilldetail SET  lastbuyprice = 510 , meanbuyprice = 510, lastbuyprice_withDiscount = 459, meanbuyprice_withDiscount = 459
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 459
                where buybilldetailid = 650;
UPDATE productunit SET proUnitBuyPrice  = 510 * productnumber WHERE productid = 1825;
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '2839';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1825', '1', '12', '0', '100', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '12', '1', '2026-10-09 18:37:17','0','0'); -- id=4253
UPDATE supplier SET  suppliercurrentDebt = '118584',suppliercurrentDebtInCurrency= '118584' , userid = '1', supplierdate = '2026-10-09 18:46:07'   WHERE supplierid = '136';
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 ('136', '0.00', '118584', '0', 'اضافة فاتورة مشتريات', '100', '118584', '2026-10-09 18:37:17', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','118584','1','0','118584','118584','0',''); -- id=300
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '118584', '118584', '2026-10-09', '1', '0', '0', '2026-10-09 18:46:07','اضافة فاتورة مشتريات رقم 100','1','0',null,'0','100','buyBillController.php?do=details&id=100'); -- id=1873
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1873', '382', '118584', '','0'); -- id=1906
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20472401.03', 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 ('1873', '619', '118584', '','0'); -- id=1873
UPDATE accountstree SET name = 'دبل اس', customName = 'دبل اس', customNameEn = 'دبل اس', nameEn = 'دبل اس', parent = '81', accountNature = '1', theValue = '118584', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 18:37:50' WHERE id = '619';
update buybill set dailyentryid='1873,0' where buybillid=100;
COMMIT;
UPDATE product SET overAllAveragePrice = 522 WHERE productId = 1812;UPDATE product SET overAllAveragePrice = 459 WHERE productId = 1813;UPDATE product SET overAllAveragePrice = 459 WHERE productId = 1814;UPDATE product SET overAllAveragePrice = 405 WHERE productId = 1815;UPDATE product SET overAllAveragePrice = 459 WHERE productId = 1816;UPDATE product SET overAllAveragePrice = 468 WHERE productId = 1817;UPDATE product SET overAllAveragePrice = 585 WHERE productId = 1818;UPDATE product SET overAllAveragePrice = 585 WHERE productId = 1819;UPDATE product SET overAllAveragePrice = 477 WHERE productId = 1820;UPDATE product SET overAllAveragePrice = 459 WHERE productId = 1821;UPDATE product SET overAllAveragePrice = 495 WHERE productId = 1822;UPDATE product SET overAllAveragePrice = 585 WHERE productId = 1823;UPDATE product SET overAllAveragePrice = 495 WHERE productId = 1824;UPDATE product SET overAllAveragePrice = 459 WHERE productId = 1825;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:16:08";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:46:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 18:46:08', '1', 'editprint', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=100'); -- id=6371
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:16:13";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:46:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 18:46:13', '1', 'showbarcodebuybill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=100&type=2'); -- id=6372
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:19:44";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:49:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 18:49:44', '1', 'showbarcodebuybill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=100&type=2'); -- id=6373
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:21:50";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:51:50", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:51:50', '3', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6374

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac90615cbe1e
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac90615cbe1e and sellbillId = 364 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:21:50";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:51:50", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:51:50', '3', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6375
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:22:44";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:52:44", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:52:44', '3', 'showDetail', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=364'); -- id=6376
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:22:44";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:52:44", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:52:44', '3', 'showDetail', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=364'); -- id=6377
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:23:05";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:23:07";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:53:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 18:53:07', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6378
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:23:07";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 18:53:07', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6379
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:23:14";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:53:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsnewController.php', '2026-10-09 18:53:14', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsnewController.php'); -- id=6380
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:23:26";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:53:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsnewController.php', '2026-10-09 18:53:26', '1', 'supplierShow2', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsnewController.php?do=supplierShow2'); -- id=6381
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:23:41";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:53:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 18:53:41', '1', 'bill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=6'); -- id=6382
UPDATE productunit SET unitid = '1', productid = '1258', productnumber = '1.00', productunitdate = '2026-09-27', userid = '1', conditions = '0',proUnitParcode='',proUnitSellAllPrice='370',proUnitSellHalfPrice='0',proUnitSellUnitPrice ='0',proUnitBuyPrice='350',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '1258';
UPDATE product SET productName = 'ليجين ريب', productDescription = '', productCatId = '75', productBuyPrice = '370', productSellAllPrice = '370', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '08358',type ='0', expireDate = '0' , dailyentryId = '613',isService = '0',isOptic = '0',lastbuyprice = '350.00',lastbuyprice_withDiscount = '350',meanbuyprice = '350.00',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='8358',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',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='1',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1258';
UPDATE productunit SET unitid = '1', productid = '1256', productnumber = '1.00', productunitdate = '2026-09-27', userid = '1', conditions = '0',proUnitParcode='',proUnitSellAllPrice='210',proUnitSellHalfPrice='0',proUnitSellUnitPrice ='0',proUnitBuyPrice='190',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '1256';
UPDATE product SET productName = 'غطس وايد ليج كيميت', productDescription = '', productCatId = '75', productBuyPrice = '190', productSellAllPrice = '210', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '05072',type ='0', expireDate = '0' , dailyentryId = '611',isService = '0',isOptic = '0',lastbuyprice = '190.00',lastbuyprice_withDiscount = '190',meanbuyprice = '190.00',meanbuyprice_withDiscount = '190' , productbuypricereal = '190' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='190',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='5072',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='190',meanbuyprice_withTax='190',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='190',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1256';
UPDATE productunit SET unitid = '1', productid = '1257', productnumber = '1.00', productunitdate = '2026-09-27', userid = '1', conditions = '0',proUnitParcode='',proUnitSellAllPrice='320',proUnitSellHalfPrice='0',proUnitSellUnitPrice ='0',proUnitBuyPrice='300',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '1257';
UPDATE product SET productName = 'سوفت جيب كيميت 320', productDescription = '', productCatId = '75', productBuyPrice = '320', productSellAllPrice = '320', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '05073',type ='0', expireDate = '0' , dailyentryId = '612',isService = '0',isOptic = '0',lastbuyprice = '300.00',lastbuyprice_withDiscount = '300',meanbuyprice = '300.00',meanbuyprice_withDiscount = '300' , productbuypricereal = '300' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='300',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='5073',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='300',meanbuyprice_withTax='300',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='1',lastbuyprice_withDiscountAndTax='300',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1257';
UPDATE productunit SET unitid = '1', productid = '1256', productnumber = '1.00', productunitdate = '2026-09-27', userid = '1', conditions = '0',proUnitParcode='',proUnitSellAllPrice='210',proUnitSellHalfPrice='0',proUnitSellUnitPrice ='0',proUnitBuyPrice='190',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '1256';
UPDATE product SET productName = 'غطس وايد ليج كيميت', productDescription = '', productCatId = '75', productBuyPrice = '210', productSellAllPrice = '210', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '05072',type ='0', expireDate = '0' , dailyentryId = '611',isService = '0',isOptic = '0',lastbuyprice = '190.00',lastbuyprice_withDiscount = '190',meanbuyprice = '190.00',meanbuyprice_withDiscount = '190' , productbuypricereal = '190' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='190',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='5072',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='190',meanbuyprice_withTax='190',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='190',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1256';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:28:08";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:58:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 18:58:08', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=6383
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('06ac90e05cb647', '2026-10-09 18:53:41', '13', '546030.00', '497124', '10', '1', '-54340.00', '-48906.00', '0', '-48906', '1', '2026-10-09 18:58:08', '', '1', '0', '', '1', '6','1','0.00','-1','0','1','0','0','0','0','0'); -- id=15
INSERT INTO returnbuybilldetail (Parcode, returnbuybillid, returnbuybilldetailcatid, returnbuybilldetailproductid, returnbuybilldetailquantity, returnbuybilldetailprice, returnbuybilldetailtotalprice, discountvalue, note, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid, returnbuybilldetailpriceC, returnbuybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,lastbuyprice_withDiscountAndTax,storeid) VALUES ('08358', '15', '75', '1258', '50', '370', '18500', '0', '', '1258','','','0','0','0','0','0','370','18500','0','0','0','0','0','0','0','1'); -- id=48
UPDATE product SET productName = 'ليجين ريب', productDescription = '', productCatId = '75', productBuyPrice = '370.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '08358',type ='0', expireDate = '0' , dailyentryId = '613',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '333',meanbuyprice = '100',meanbuyprice_withDiscount = '562.5' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='8358',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='370',meanbuyprice_withTax='100',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='1',lastbuyprice_withDiscountAndTax='333',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1258';
UPDATE returnbuybilldetail SET  lastbuyprice = 370 , meanbuyprice = 100, lastbuyprice_withDiscount = 333, meanbuyprice_withDiscount = 562.5
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 100, lastbuyprice_withDiscountAndTax = 333
                where returnbuybilldetailid = 48;
UPDATE productunit SET proUnitBuyPrice  = 370 * productnumber WHERE productid = 1258;
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1258';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1258', '1', '50', '1', '15', 'اضافة فاتورة مردودات مشتريات', 'returnBuyBillController.php', '54', '4', '1', '2026-10-09 18:53:41','0','0'); -- id=4255
INSERT INTO returnbuybilldetail (Parcode, returnbuybillid, returnbuybilldetailcatid, returnbuybilldetailproductid, returnbuybilldetailquantity, returnbuybilldetailprice, returnbuybilldetailtotalprice, discountvalue, note, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid, returnbuybilldetailpriceC, returnbuybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,lastbuyprice_withDiscountAndTax,storeid) VALUES ('05073', '15', '75', '1257', '91', '320', '29120', '0', '', '1257','','','0','0','0','0','0','320','29120','0','0','0','0','0','0','0','1'); -- id=49
UPDATE product SET productName = 'سوفت جيب كيميت 320', productDescription = '', productCatId = '75', productBuyPrice = '320.00', productSellAllPrice = '320.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '05073',type ='0', expireDate = '0' , dailyentryId = '612',isService = '0',isOptic = '0',lastbuyprice = '320',lastbuyprice_withDiscount = '288',meanbuyprice = '906.67',meanbuyprice_withDiscount = '64' , productbuypricereal = '300.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='300',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='5073',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='320',meanbuyprice_withTax='906.67',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='1',lastbuyprice_withDiscountAndTax='288',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1257';
UPDATE returnbuybilldetail SET  lastbuyprice = 320 , meanbuyprice = 906.67, lastbuyprice_withDiscount = 288, meanbuyprice_withDiscount = 64
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 906.67, lastbuyprice_withDiscountAndTax = 288
                where returnbuybilldetailid = 49;
UPDATE productunit SET proUnitBuyPrice  = 320 * productnumber WHERE productid = 1257;
UPDATE storedetail SET  productquantity = '-3', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1257';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1257', '1', '91', '1', '15', 'اضافة فاتورة مردودات مشتريات', 'returnBuyBillController.php', '88', '-3', '1', '2026-10-09 18:53:41','0','0'); -- id=4256
INSERT INTO returnbuybilldetail (Parcode, returnbuybillid, returnbuybilldetailcatid, returnbuybilldetailproductid, returnbuybilldetailquantity, returnbuybilldetailprice, returnbuybilldetailtotalprice, discountvalue, note, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid, returnbuybilldetailpriceC, returnbuybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,lastbuyprice_withDiscountAndTax,storeid) VALUES ('05072', '15', '75', '1256', '32', '210', '6720', '0', '', '1256','','','0','0','0','0','0','210','6720','0','0','0','0','0','0','0','1'); -- id=50
UPDATE product SET productName = 'غطس وايد ليج كيميت', productDescription = '', productCatId = '75', productBuyPrice = '210.00', productSellAllPrice = '210.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '05072',type ='0', expireDate = '0' , dailyentryId = '611',isService = '0',isOptic = '0',lastbuyprice = '210',lastbuyprice_withDiscount = '189',meanbuyprice = '130',meanbuyprice_withDiscount = '206' , productbuypricereal = '190.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='190',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='5072',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='210',meanbuyprice_withTax='130',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='1',lastbuyprice_withDiscountAndTax='189',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1256';
UPDATE returnbuybilldetail SET  lastbuyprice = 210 , meanbuyprice = 130, lastbuyprice_withDiscount = 189, meanbuyprice_withDiscount = 206
        , lastbuyprice_withTax = 210, meanbuyprice_withTax = 130, lastbuyprice_withDiscountAndTax = 189
                where returnbuybilldetailid = 50;
UPDATE productunit SET proUnitBuyPrice  = 210 * productnumber WHERE productid = 1256;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1256';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1256', '1', '32', '1', '15', 'اضافة فاتورة مردودات مشتريات', 'returnBuyBillController.php', '34', '2', '1', '2026-10-09 18:53:41','0','0'); -- id=4257
UPDATE supplier SET  suppliercurrentDebt = '182525',suppliercurrentDebtInCurrency= '497124' , userid = '1', supplierdate = '2026-10-09 18:58:08'   WHERE supplierid = '13';
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 ('13', '231431.00', '48906', '1', 'اضافة فاتورة مردوات مشتريات', '15', '182525', '2026-10-09 18:53:41', '1', 'returnBuyBillController.php', 'اضافة فاتورة مردوات مشتريات', '0','', '0','1','1','48906','1','546030','48906','497124','0',''); -- id=301
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '48906', '48906', '2026-10-09', '1', '0', '0', '2026-10-09 18:58:08','اضافة فاتورة مردود مشتريات رقم 15','1','0',null,'0','15','returnBuyBillController.php?do=details&id=15'); -- id=1876
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1876', '432', '48906', '','0'); -- id=1909
UPDATE accountstree SET name = 'كيميت اكس - مورد', customName = 'كيميت اكس - مورد', customNameEn = 'كيميت اكس - مورد', nameEn = 'كيميت اكس - مورد', parent = '81', accountNature = '1', theValue = '-48906', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '432';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1876', '382', '48906', '','0'); -- id=1876
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20418311.03', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update returnbuybill set dailyentryid='1876,0' where returnbuybillid=15;
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:28:08";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:58:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnBuyBillController.php', '2026-10-09 18:58:08', '1', 'editprint', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/returnBuyBillController.php?do=editprint&id=15'); -- id=6384
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:28:52";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:58:52", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:58:52', '3', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6385
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:28:52";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:58:52", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 18:58:52', '3', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6386
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:29:33";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:59:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 18:59:33', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6387
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:29:39";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:59:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 18:59:39', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6388
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:29:47";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:59:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-09 18:59:47', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php'); -- id=6389
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:29:56";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 18:59:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-09 18:59:56', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php?do=show'); -- id=6390
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:30:05";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:00:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 19:00:05', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6391
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:30:16";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:00:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 19:00:16', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6392
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:37:18";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:07:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-09 19:07:18', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php'); -- id=6393
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:37:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:07:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-09 19:07:34', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php?do=show'); -- id=6394
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:38:05";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:08:05", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 19:08:05', '2', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6395

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac90c2c9d0f7
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 19:08:05', '06ac90c2c9d0f7', '1', '0.00', '0', '0', '1', '57300.00', '57300', '57300', '0', '1', '2026-10-09 19:08:05', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '112' ,'0','','','','','-1','0','0','0','0','0','57300','0','','0','0','57300','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=365
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','365', '0', '2026-10-09 19:08:05', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '57300', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 19:08:05','0','0','',''); -- id=474
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 530;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('496.8','01628', '365', '120', '1628', '3', '540', '1620', '0', '', '0', '2026-10-09 19:08:05', '1628', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','530-3,','1','1','0','0','540','1620','0','','0','0.00','0','0','0','0'); -- id=1272
UPDATE sellbilldetail SET  lastbuyprice = 540.00 , meanbuyprice = 540.00, lastbuyprice_withDiscount = 496.80, meanbuyprice_withDiscount = 496.80
        , lastbuyprice_withTax = 540, meanbuyprice_withTax = 540, lastbuyprice_withDiscountAndTax = 496.8
                where sellbilldetailid = 1272;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1628, '2026-10-09', 1620, 1620, 1620
                    , 1620, 1490.4, 1490.4, 1490.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1620, 1620, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1620, sellCostBuyPrice =sellCostBuyPrice+1620
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1620, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1620
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1490.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1490.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1490.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1620
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1620
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1620, 1620, 1620
                    , 1620, 1490.4, 1490.4, 1490.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1620, 1620, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1620, sellCostBuyPrice =sellCostBuyPrice+1620
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1620, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1620
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1490.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1490.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1490.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1620
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1620
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '1653';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1628', '1', '3', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '21', '2', '2026-10-09 19:08:05','0','0'); -- id=4258
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 777;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('423.2','01795', '365', '126', '1795', '12', '460', '5520', '0', '', '0', '2026-10-09 19:08:05', '1795', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','777-12,','1','1','0','0','460','5520','0','','0','0.00','0','0','0','0'); -- id=1273
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 423.20, meanbuyprice_withDiscount = 423.20
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 423.2
                where sellbilldetailid = 1273;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1795, '2026-10-09', 5520, 5520, 5520
                    , 5520, 5078.4, 5078.4, 5078.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 5520, 5520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5520, sellCostBuyPrice =sellCostBuyPrice+5520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5078.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5078.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5078.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5520, 5520, 5520
                    , 5520, 5078.4, 5078.4, 5078.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5520, 5520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5520, sellCostBuyPrice =sellCostBuyPrice+5520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5078.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5078.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5078.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '2808';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1795', '1', '12', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '12', '2', '2026-10-09 19:08:05','0','0'); -- id=4259
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 555;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','01691', '365', '126', '1691', '3', '450', '1350', '0', '', '0', '2026-10-09 19:08:05', '1691', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','555-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=1274
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1274;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1691, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '2703';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1691', '1', '3', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '0', '2', '2026-10-09 19:08:05','0','0'); -- id=4260
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 684;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('490','01770', '365', '137', '1770', '4', '530', '2120', '0', '', '0', '2026-10-09 19:08:05', '1770', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','684-4,','1','1','0','0','530','2120','0','','0','0.00','0','0','0','0'); -- id=1275
UPDATE sellbilldetail SET  lastbuyprice = 490.00 , meanbuyprice = 490.00, lastbuyprice_withDiscount = 490.00, meanbuyprice_withDiscount = 490.00
        , lastbuyprice_withTax = 490, meanbuyprice_withTax = 490, lastbuyprice_withDiscountAndTax = 490
                where sellbilldetailid = 1275;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1770, '2026-10-09', 2120, 1960, 1960
                    , 1960, 1960, 1960, 1960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1960, 1960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2120, sellCostBuyPrice =sellCostBuyPrice+1960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2120, 1960, 1960
                    , 1960, 1960, 1960, 1960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1960, 1960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2120, sellCostBuyPrice =sellCostBuyPrice+1960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '2783';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1770', '1', '4', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '40', '36', '2', '2026-10-09 19:08:05','0','0'); -- id=4261
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 531;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','01629', '365', '120', '1629', '3', '450', '1350', '0', '', '0', '2026-10-09 19:08:05', '1629', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','531-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=1276
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1276;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1629, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '1654';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1629', '1', '3', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '24', '2', '2026-10-09 19:08:05','0','0'); -- id=4262
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 738;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('252','01780', '365', '99', '1780', '12', '280', '3360', '0', '', '0', '2026-10-09 19:08:05', '1780', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','738-12,','1','1','0','0','280','3360','0','','0','0.00','0','0','0','0'); -- id=1277
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 280.00, lastbuyprice_withDiscount = 252.00, meanbuyprice_withDiscount = 252.00
        , lastbuyprice_withTax = 280, meanbuyprice_withTax = 280, lastbuyprice_withDiscountAndTax = 252
                where sellbilldetailid = 1277;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1780, '2026-10-09', 3360, 3360, 3360
                    , 3360, 3024, 3024, 3024
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3360, 3360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3024, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3024
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3024
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3360, 3360, 3360
                    , 3360, 3024, 3024, 3024
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3360, 3360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3024, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3024
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3024
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '2793';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1780', '1', '12', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '48', '36', '2', '2026-10-09 19:08:05','0','0'); -- id=4263
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 212;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('510','01431', '365', '100', '1431', '3', '540', '1620', '0', '', '0', '2026-10-09 19:08:05', '1431', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','212-3,','1','1','0','0','540','1620','0','','0','0.00','0','0','0','0'); -- id=1278
UPDATE sellbilldetail SET  lastbuyprice = 510.00 , meanbuyprice = 507.50, lastbuyprice_withDiscount = 510.00, meanbuyprice_withDiscount = 507.50
        , lastbuyprice_withTax = 507.5, meanbuyprice_withTax = 507.5, lastbuyprice_withDiscountAndTax = 510
                where sellbilldetailid = 1278;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1431, '2026-10-09', 1620, 1515, 1530
                    , 1522.5, 1530, 1522.5, 1530
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1522.5, 1522.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1620, sellCostBuyPrice =sellCostBuyPrice+1515
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1530, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1522.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1522.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1530
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1522.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1522.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+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1620, 1515, 1530
                    , 1522.5, 1530, 1522.5, 1530
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1522.5, 1522.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1620, sellCostBuyPrice =sellCostBuyPrice+1515
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1530, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1522.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1522.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1530
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1522.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1522.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 = '15', userid = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '1444';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1431', '1', '3', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '15', '2', '2026-10-09 19:08:05','0','0'); -- id=4264
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 520;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('542.8','01671', '365', '124', '1671', '3', '590', '1770', '0', '', '0', '2026-10-09 19:08:05', '1671', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','520-3,','1','1','0','0','590','1770','0','','0','0.00','0','0','0','0'); -- id=1279
UPDATE sellbilldetail SET  lastbuyprice = 590.00 , meanbuyprice = 590.00, lastbuyprice_withDiscount = 542.80, meanbuyprice_withDiscount = 542.80
        , lastbuyprice_withTax = 590, meanbuyprice_withTax = 590, lastbuyprice_withDiscountAndTax = 542.8
                where sellbilldetailid = 1279;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1671, '2026-10-09', 1770, 1770, 1770
                    , 1770, 1628.4, 1628.4, 1628.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1770, 1770, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1770, sellCostBuyPrice =sellCostBuyPrice+1770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1770, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1770
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1628.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1628.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1628.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1770
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1770
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1770, 1770, 1770
                    , 1770, 1628.4, 1628.4, 1628.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1770, 1770, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1770, sellCostBuyPrice =sellCostBuyPrice+1770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1770, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1770
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1628.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1628.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1628.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1770
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1770
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '2683';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1671', '1', '3', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '24', '2', '2026-10-09 19:08:05','0','0'); -- id=4265
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 672;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('470','01758', '365', '136', '1758', '4', '510', '2040', '0', '', '0', '2026-10-09 19:08:05', '1758', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','672-4,','1','1','0','0','510','2040','0','','0','0.00','0','0','0','0'); -- id=1280
UPDATE sellbilldetail SET  lastbuyprice = 470.00 , meanbuyprice = 470.00, lastbuyprice_withDiscount = 470.00, meanbuyprice_withDiscount = 470.00
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 470
                where sellbilldetailid = 1280;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1758, '2026-10-09', 2040, 1880, 1880
                    , 1880, 1880, 1880, 1880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1880, 1880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2040, sellCostBuyPrice =sellCostBuyPrice+1880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2040, 1880, 1880
                    , 1880, 1880, 1880, 1880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1880, 1880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2040, sellCostBuyPrice =sellCostBuyPrice+1880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '2771';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1758', '1', '4', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '32', '28', '2', '2026-10-09 19:08:05','0','0'); -- id=4266
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 213;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('485','01432', '365', '100', '1432', '3', '515', '1545', '0', '', '0', '2026-10-09 19:08:05', '1432', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','213-3,','1','1','0','0','515','1545','0','','0','0.00','0','0','0','0'); -- id=1281
UPDATE sellbilldetail SET  lastbuyprice = 485.00 , meanbuyprice = 482.50, lastbuyprice_withDiscount = 485.00, meanbuyprice_withDiscount = 482.50
        , lastbuyprice_withTax = 482.5, meanbuyprice_withTax = 482.5, lastbuyprice_withDiscountAndTax = 485
                where sellbilldetailid = 1281;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1432, '2026-10-09', 1545, 1440, 1455
                    , 1447.5, 1455, 1447.5, 1455
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1447.5, 1447.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1545, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1455, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1447.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1455, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1447.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1455
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1447.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1447.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+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1545, 1440, 1455
                    , 1447.5, 1455, 1447.5, 1455
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1447.5, 1447.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1545, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1455, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1447.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1455, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1447.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1455
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1447.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1447.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 = '12', userid = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '1445';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1432', '1', '3', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '12', '2', '2026-10-09 19:08:05','0','0'); -- id=4267
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 777;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('423.2','01795', '365', '126', '1795', '3', '460', '1380', '0', '', '0', '2026-10-09 19:08:05', '1795', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','777-3,','1','1','0','0','460','1380','0','','0','0.00','0','0','0','0'); -- id=1282
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 423.20, meanbuyprice_withDiscount = 423.20
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 423.2
                where sellbilldetailid = 1282;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1795, '2026-10-09', 1380, 1380, 1380
                    , 1380, 1269.6, 1269.6, 1269.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1269.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1269.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1269.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1380, 1380, 1380
                    , 1380, 1269.6, 1269.6, 1269.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1269.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1269.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1269.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '2808';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1795', '1', '3', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '9', '2', '2026-10-09 19:08:05','0','0'); -- id=4268
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 531;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','01629', '365', '120', '1629', '3', '450', '1350', '0', '', '0', '2026-10-09 19:08:05', '1629', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','531-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=1283
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1283;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1629, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '1654';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1629', '1', '3', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '21', '2', '2026-10-09 19:08:05','0','0'); -- id=4269
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 625;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('427.8','01726', '365', '132', '1726', '3', '465', '1395', '0', '', '0', '2026-10-09 19:08:05', '1726', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','625-3,','1','1','0','0','465','1395','0','','0','0.00','0','0','0','0'); -- id=1284
UPDATE sellbilldetail SET  lastbuyprice = 465.00 , meanbuyprice = 465.00, lastbuyprice_withDiscount = 427.80, meanbuyprice_withDiscount = 446.40
        , lastbuyprice_withTax = 465, meanbuyprice_withTax = 232.5, lastbuyprice_withDiscountAndTax = 427.8
                where sellbilldetailid = 1284;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1726, '2026-10-09', 1395, 1395, 1395
                    , 1395, 1283.4, 1339.2, 1283.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1395, 697.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1395, sellCostBuyPrice =sellCostBuyPrice+1395
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1395, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1395
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1283.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1339.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1283.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1395
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+697.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+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1395, 1395, 1395
                    , 1395, 1283.4, 1339.2, 1283.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1395, 697.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1395, sellCostBuyPrice =sellCostBuyPrice+1395
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1395, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1395
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1283.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1339.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1283.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1395
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+697.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 = '21', userid = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '2739';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1726', '1', '3', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '21', '2', '2026-10-09 19:08:05','0','0'); -- id=4270
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 155;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('339.99','01405', '365', '99', '1405', '4', '340', '1360', '0', '', '0', '2026-10-09 19:08:05', '1405', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','155-4,','1','1','0','0','340','1360','0','','0','0.00','0','0','0','0'); -- id=1285
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 339.99, meanbuyprice_withDiscount = 339.99
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 340, lastbuyprice_withDiscountAndTax = 339.99
                where sellbilldetailid = 1285;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1405, '2026-10-09', 1360, 1360, 1360
                    , 1360, 1359.96, 1359.96, 1359.96
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1360, 1360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1360, sellCostBuyPrice =sellCostBuyPrice+1360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1359.96, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1359.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1359.96
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1360, 1360, 1360
                    , 1360, 1359.96, 1359.96, 1359.96
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1360, 1360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1360, sellCostBuyPrice =sellCostBuyPrice+1360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1359.96, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1359.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1359.96
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '244', userid = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '1418';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1405', '1', '4', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '248', '244', '2', '2026-10-09 19:08:05','0','0'); -- id=4271
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 581;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('510','01718', '365', '131', '1718', '15', '535', '8025', '0', '', '0', '2026-10-09 19:08:05', '1718', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','581-15,','1','1','0','0','535','8025','0','','0','0.00','0','0','0','0'); -- id=1286
UPDATE sellbilldetail SET  lastbuyprice = 510.00 , meanbuyprice = 510.00, lastbuyprice_withDiscount = 510.00, meanbuyprice_withDiscount = 510.00
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 510
                where sellbilldetailid = 1286;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1718, '2026-10-09', 8025, 7650, 7650
                    , 7650, 7650, 7650, 7650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 7650, 7650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8025, sellCostBuyPrice =sellCostBuyPrice+7650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-10-09', 8025, 7650, 7650
                    , 7650, 7650, 7650, 7650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7650, 7650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8025, sellCostBuyPrice =sellCostBuyPrice+7650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '2730';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1718', '1', '15', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '135', '120', '2', '2026-10-09 19:08:05','0','0'); -- id=4272
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 581;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('510','01718', '365', '131', '1718', '9', '535', '4815', '0', '', '0', '2026-10-09 19:08:05', '1718', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','581-9,','1','1','0','0','535','4815','0','','0','0.00','0','0','0','0'); -- id=1287
UPDATE sellbilldetail SET  lastbuyprice = 510.00 , meanbuyprice = 510.00, lastbuyprice_withDiscount = 510.00, meanbuyprice_withDiscount = 510.00
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 510
                where sellbilldetailid = 1287;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1718, '2026-10-09', 4815, 4590, 4590
                    , 4590, 4590, 4590, 4590
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4590, 4590, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4815, sellCostBuyPrice =sellCostBuyPrice+4590
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4590, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4590
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4590, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4590
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4590
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4590
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4590
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4815, 4590, 4590
                    , 4590, 4590, 4590, 4590
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4590, 4590, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4815, sellCostBuyPrice =sellCostBuyPrice+4590
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4590, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4590
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4590, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4590
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4590
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4590
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4590
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '2730';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1718', '1', '9', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '120', '111', '2', '2026-10-09 19:08:05','0','0'); -- id=4273
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 675;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('470','01761', '365', '136', '1761', '8', '510', '4080', '0', '', '0', '2026-10-09 19:08:05', '1761', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','675-8,','1','1','0','0','510','4080','0','','0','0.00','0','0','0','0'); -- id=1288
UPDATE sellbilldetail SET  lastbuyprice = 470.00 , meanbuyprice = 470.00, lastbuyprice_withDiscount = 470.00, meanbuyprice_withDiscount = 470.00
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 470
                where sellbilldetailid = 1288;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1761, '2026-10-09', 4080, 3760, 3760
                    , 3760, 3760, 3760, 3760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 3760, 3760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4080, sellCostBuyPrice =sellCostBuyPrice+3760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4080, 3760, 3760
                    , 3760, 3760, 3760, 3760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3760, 3760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4080, sellCostBuyPrice =sellCostBuyPrice+3760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '2774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1761', '1', '8', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '32', '24', '2', '2026-10-09 19:08:05','0','0'); -- id=4274
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 683;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('980','01769', '365', '137', '1769', '8', '1050', '8400', '0', '', '0', '2026-10-09 19:08:05', '1769', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','683-8,','1','1','0','0','1050','8400','0','','0','0.00','0','0','0','0'); -- id=1289
UPDATE sellbilldetail SET  lastbuyprice = 980.00 , meanbuyprice = 980.00, lastbuyprice_withDiscount = 980.00, meanbuyprice_withDiscount = 980.00
        , lastbuyprice_withTax = 980, meanbuyprice_withTax = 980, lastbuyprice_withDiscountAndTax = 980
                where sellbilldetailid = 1289;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1769, '2026-10-09', 8400, 7840, 7840
                    , 7840, 7840, 7840, 7840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 7840, 7840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8400, sellCostBuyPrice =sellCostBuyPrice+7840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 8400, 7840, 7840
                    , 7840, 7840, 7840, 7840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7840, 7840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8400, sellCostBuyPrice =sellCostBuyPrice+7840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '2782';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1769', '1', '8', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16', '8', '2', '2026-10-09 19:08:05','0','0'); -- id=4275
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 516;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('437','01667', '365', '124', '1667', '6', '475', '2850', '0', '', '0', '2026-10-09 19:08:05', '1667', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','516-6,','1','1','0','0','475','2850','0','','0','0.00','0','0','0','0'); -- id=1290
UPDATE sellbilldetail SET  lastbuyprice = 475.00 , meanbuyprice = 475.00, lastbuyprice_withDiscount = 437.00, meanbuyprice_withDiscount = 437.00
        , lastbuyprice_withTax = 475, meanbuyprice_withTax = 475, lastbuyprice_withDiscountAndTax = 437
                where sellbilldetailid = 1290;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1667, '2026-10-09', 2850, 2850, 2850
                    , 2850, 2622, 2622, 2622
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2850, sellCostBuyPrice =sellCostBuyPrice+2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2622, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2622
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2622
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2850, 2850, 2850
                    , 2850, 2622, 2622, 2622
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2850, sellCostBuyPrice =sellCostBuyPrice+2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2622, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2622
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2622
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '2679';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1667', '1', '6', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6', '0', '2', '2026-10-09 19:08:05','0','0'); -- id=4276
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 778;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','i0001796', '365', '126', '1796', '3', '450', '1350', '0', '', '0', '2026-10-09 19:08:05', '1796', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','778-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=1291
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1291;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1796, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '6', userid = '2', storedetaildate = '2026-10-09 19:08:05' WHERE storedetailid = '2809';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1796', '1', '3', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '6', '2', '2026-10-09 19:08:05','0','0'); -- id=4277
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2225318',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('2168018','57300', '0', '2', 'اضافة فاتورة مبيعات', '365', '2225318', '2026-10-09 19:08:05', '2',  'sellbillController.php','1','','0'); -- id=412
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '57300', '57300', '2026-10-09', '2', '0', '0', '2026-10-09 19:08:05','اضافة فاتورة مبيعات رقم 365','1','0',null,'0','365','sellbillController.php?do=showDetail&sellbillid=365'); -- id=1877
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1877', '419', '57300', '','0'); -- id=1910
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '2225315', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1877', '143', '57300', '','0'); -- id=1877
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3826035', 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 ( '53389.16', '53389.16', '2026-10-09', '2', '0', '0', '2026-10-09 19:08:05','اضافة فاتورة مبيعات رقم 365 - صرف البضاعة من المخزن','1','0',null,'0','365','sellbillController.php?do=showDetail&sellbillid=365'); -- id=1878
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1878', '402', '53389.16', '','0'); -- id=1911
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3594897.33', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1878', '382', '53389.16', '','0'); -- id=1878
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20364921.87', 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='1877,0,1878' where sellbillid=365;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 57300, 55290, 55320
                    , 55305, 53389.16, 53429.96, 53389.16
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,55305, 54607.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+57300, sellCostBuyPrice =sellCostBuyPrice+55290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+55320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+55305
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+53389.16, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+53429.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+53389.16
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+55305
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+54607.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-10-09', 57300, 55290, 55320
                    , 55305, 53389.16, 53429.96, 53389.16
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,55305, 54607.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+57300, sellCostBuyPrice =sellCostBuyPrice+55290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+55320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+55305
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+53389.16, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+53429.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+53389.16
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+55305
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+54607.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, 57300, 55290, 55320
                    , 55305, 53389.16, 53429.96, 53389.16, 55305, 54607.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+57300, netSellCostBuyPrice = netSellCostBuyPrice+55290
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+55320
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+55305
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+53389.16
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+53429.96
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+53389.16
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+55305
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+54607.5;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac90c2c9d0f7 and sellbillId = 365 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:38:05";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:08:05", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 19:08:05', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6396
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:38:54";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:08:54", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 19:08:54', '2', 'showDetail', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=365'); -- id=6397
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:39:44";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:39:46";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:09:46", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 19:09:46', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6398
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:39:49";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:09:49", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 19:09:49', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6399
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:39:49";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:09:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 19:09:49', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6400
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:39:49";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 19:09:49', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6401
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:39:59";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:09:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 19:09:59', '1', 'bill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=6402
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:40:04";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:10:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-09 19:10:04', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php'); -- id=6403
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:40:04";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:10:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-09 19:10:04', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=6404
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:40:07";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:10:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-09 19:10:07', '1', 'details', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=details&id=100'); -- id=6405
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:40:10";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:10:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-09 19:10:10', '1', 'showbarcodebuybill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=100&type=2'); -- id=6406
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:42:09";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:12:09", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 19:12:09', '6', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6407
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:50:30";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:20:30", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 19:20:30', '6', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6408
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:51:51";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:21:51", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 19:21:51', '4', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6409
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:53:26";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:53:36";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:23:36", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 19:23:36', '4', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6410
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:53:36";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-09 19:23:36", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 19:23:36', '4', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6411
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:53:38";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:23:38", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 19:23:38', '4', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6412
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 15:55:47";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:25:47", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 19:25:47', '4', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6413
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:00:25";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:30:25", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 19:30:25', '4', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6414

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac9158b0f5dc
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 19:30:25', '06ac9158b0f5dc', '1', '0.00', '0', '0', '1', '3300.00', '3300', '3300', '0', '2', '2026-10-09 19:30:25', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '6' ,'0','','','','','-1','0','0','0','0','0','3300','0','','0','0','3300','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=366
UPDATE client SET  clientdebt = '0', userid = '4' 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','اضافة فاتورة مبيعات','366', '0', '2026-10-09 19:30:25', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3300', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 19:30:25','0','0','',''); -- id=475
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 621;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('495','01722', '366', '49', '1722', '6', '550', '3300', '0', '', '0', '2026-10-09 19:30:25', '1722', '0.00', '0', '2','0.00','','','0','0','0','0','0','0','0','0','','621-6,','1','1','0','0','550','3300','0','','0','0.00','0','0','0','0'); -- id=1292
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 495.00, meanbuyprice_withDiscount = 495.00
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 495
                where sellbilldetailid = 1292;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1722, '2026-10-09', 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2970
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2970
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2970
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2970
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '4', storedetaildate = '2026-10-09 19:30:25' WHERE storedetailid = '2735';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1722', '2', '6', '1', '366', 'اضافة فاتورة مبيعات', 'sellbillController.php', '42', '36', '4', '2026-10-09 19:30:25','0','0'); -- id=4278
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '485510',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('482210','3300', '0', '3', 'اضافة فاتورة مبيعات', '366', '485510', '2026-10-09 19:30:25', '4',  'sellbillController.php','1','','0'); -- id=413
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3300', '3300', '2026-10-09', '4', '0', '0', '2026-10-09 19:30:25','اضافة فاتورة مبيعات رقم 366','1','0',null,'0','366','sellbillController.php?do=showDetail&sellbillid=366'); -- id=1879
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1879', '501', '3300', '','0'); -- id=1912
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '485510', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1879', '143', '3300', '','0'); -- id=1879
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3829335', 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 ( '2970', '2970', '2026-10-09', '4', '0', '0', '2026-10-09 19:30:25','اضافة فاتورة مبيعات رقم 366 - صرف البضاعة من المخزن','1','0',null,'0','366','sellbillController.php?do=showDetail&sellbillid=366'); -- id=1880
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1880', '402', '2970', '','0'); -- id=1913
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3597867.33', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1880', '492', '2970', '','0'); -- id=1880
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '709220', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1879,0,1880' where sellbillid=366;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2970
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2970
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2970
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2970
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, 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, 3300, 3300, 3300
                    , 3300, 2970, 2970, 2970, 3300, 3300)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3300, netSellCostBuyPrice = netSellCostBuyPrice+3300
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3300
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3300
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2970
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2970
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2970
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3300
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3300;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac9158b0f5dc and sellbillId = 366 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:00:25";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:30:25", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 19:30:25', '4', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6415
UPDATE user SET loginip = "" WHERE userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:08:25";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:08:27";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:38:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 19:38:27', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6416
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:08:27";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 19:38:27', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6417
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:09:00";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:39:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 19:39:00', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php'); -- id=6418
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:09:02";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:39:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 19:39:02', '1', 'showallajax', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php?do=showallajax'); -- id=6419
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:09:08";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:39:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 19:39:08', '1', 'showallajax', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php?do=showallajax'); -- id=6420
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:09:12";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:39:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 19:39:12', '1', 'showallajax', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php?do=showallajax'); -- id=6421
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:09:15";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:39:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 19:39:15', '1', 'showallajax', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php?do=showallajax'); -- id=6422
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:13:37";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:43:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-09 19:43:37', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php?do=show'); -- id=6423
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:13:47";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:43:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsnewController.php', '2026-10-09 19:43:47', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsnewController.php'); -- id=6424
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:14:26";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:44:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsnewController.php', '2026-10-09 19:44:26', '1', 'supplierShow2', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsnewController.php?do=supplierShow2'); -- id=6425
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:14:49";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:44:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-09 19:44:49', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php'); -- id=6426
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:14:58";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:44:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-09 19:44:58', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php?do=show'); -- id=6427
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:15:21";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:45:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsnewController.php', '2026-10-09 19:45:21', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsnewController.php'); -- id=6428
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:15:27";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:45:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsnewController.php', '2026-10-09 19:45:27', '1', 'supplierShow2', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsnewController.php?do=supplierShow2'); -- id=6429
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:18:52";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:48:52", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 19:48:52', '2', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6430

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac911cd1e735
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 19:48:52', '06ac911cd1e735', '1', '0.00', '0', '0', '1', '6450.00', '6450', '6450', '0', '1', '2026-10-09 19:48:52', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '12' ,'0','','','','','-1','0','0','0','0','0','6450','0','','0','0','6450','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=367
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','367', '0', '2026-10-09 19:48:52', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '6450', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 19:48:52','0','0','',''); -- id=476
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 581;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('510','01718', '367', '131', '1718', '9', '535', '4815', '0', '', '0', '2026-10-09 19:48:52', '1718', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','581-9,','1','1','0','0','535','4815','0','','0','0.00','0','0','0','0'); -- id=1293
UPDATE sellbilldetail SET  lastbuyprice = 510.00 , meanbuyprice = 510.00, lastbuyprice_withDiscount = 510.00, meanbuyprice_withDiscount = 510.00
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 510
                where sellbilldetailid = 1293;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1718, '2026-10-09', 4815, 4590, 4590
                    , 4590, 4590, 4590, 4590
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4590, 4590, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4815, sellCostBuyPrice =sellCostBuyPrice+4590
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4590, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4590
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4590, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4590
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4590
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4590
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4590
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4815, 4590, 4590
                    , 4590, 4590, 4590, 4590
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4590, 4590, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4815, sellCostBuyPrice =sellCostBuyPrice+4590
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4590, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4590
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4590, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4590
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4590
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4590
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4590
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '102', userid = '2', storedetaildate = '2026-10-09 19:48:52' WHERE storedetailid = '2730';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1718', '1', '9', '1', '367', 'اضافة فاتورة مبيعات', 'sellbillController.php', '111', '102', '2', '2026-10-09 19:48:52','0','0'); -- id=4279
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 580;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('520','01717', '367', '131', '1717', '3', '545', '1635', '0', '', '0', '2026-10-09 19:48:52', '1717', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','580-3,','1','1','0','0','545','1635','0','','0','0.00','0','0','0','0'); -- id=1294
UPDATE sellbilldetail SET  lastbuyprice = 520.00 , meanbuyprice = 520.00, lastbuyprice_withDiscount = 520.00, meanbuyprice_withDiscount = 520.00
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 520
                where sellbilldetailid = 1294;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1717, '2026-10-09', 1635, 1560, 1560
                    , 1560, 1560, 1560, 1560
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1560, 1560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1635, sellCostBuyPrice =sellCostBuyPrice+1560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1560
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1635, 1560, 1560
                    , 1560, 1560, 1560, 1560
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1560, 1560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1635, sellCostBuyPrice =sellCostBuyPrice+1560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1560
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2', storedetaildate = '2026-10-09 19:48:52' WHERE storedetailid = '2729';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1717', '1', '3', '1', '367', 'اضافة فاتورة مبيعات', 'sellbillController.php', '114', '111', '2', '2026-10-09 19:48:52','0','0'); -- id=4280
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2231768',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('2225318','6450', '0', '2', 'اضافة فاتورة مبيعات', '367', '2231768', '2026-10-09 19:48:52', '2',  'sellbillController.php','1','','0'); -- id=414
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6450', '6450', '2026-10-09', '2', '0', '0', '2026-10-09 19:48:52','اضافة فاتورة مبيعات رقم 367','1','0',null,'0','367','sellbillController.php?do=showDetail&sellbillid=367'); -- id=1881
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1881', '419', '6450', '','0'); -- id=1914
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '2231765', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1881', '143', '6450', '','0'); -- id=1881
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3835785', 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 ( '6150', '6150', '2026-10-09', '2', '0', '0', '2026-10-09 19:48:52','اضافة فاتورة مبيعات رقم 367 - صرف البضاعة من المخزن','1','0',null,'0','367','sellbillController.php?do=showDetail&sellbillid=367'); -- id=1882
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1882', '402', '6150', '','0'); -- id=1915
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3604017.33', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1882', '382', '6150', '','0'); -- id=1882
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20358771.87', 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='1881,0,1882' where sellbillid=367;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 6450, 6150, 6150
                    , 6150, 6150, 6150, 6150
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6150, 6150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6450, sellCostBuyPrice =sellCostBuyPrice+6150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 6450, 6150, 6150
                    , 6150, 6150, 6150, 6150
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6150, 6150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6450, sellCostBuyPrice =sellCostBuyPrice+6150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6150
                        , returnSellVal = returnSellVal+0, 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, 6450, 6150, 6150
                    , 6150, 6150, 6150, 6150, 6150, 6150)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6450, netSellCostBuyPrice = netSellCostBuyPrice+6150
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+6150
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+6150
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+6150
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+6150
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+6150
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+6150
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+6150;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac911cd1e735 and sellbillId = 367 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:18:52";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:48:52", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 19:48:52', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6431
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:21:25";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:51:25", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 19:51:25', '2', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6432
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:21:57";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:51:57", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 19:51:57', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6433
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:26:53";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 19:56:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 19:56:53', '1', 'bill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=6'); -- id=6434
UPDATE user SET loginip = "" WHERE userid = 4;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:31:03";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:01:03", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:01:03', '2', 'addAndRetuen', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=6435

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac91bad2d281
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 20:01:03', '06ac91bad2d281', '1', '0.00', '0', '0', '1', '3360.00', '3360', '3360', '0', '1', '2026-10-09 20:01:03', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '12' ,'0','','','','','-1','0','0','0','0','0','3360','0','','0','0','3360','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-09','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=368
UPDATE client SET  clientdebt = '0', userid = '2' 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','اضافة فاتورة مبيعات','368', '0', '2026-10-09 20:01:03', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3360', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 20:01:03','0','0','',''); -- id=477
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 738;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('252','01780', '368', '99', '1780', '12', '280', '3360', '0', '', '0', '2026-10-09 20:01:03', '1780', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','738-12,','1','1','0','0','280','3360','0','','0','0.00','0','0','0','0'); -- id=1295
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 280.00, lastbuyprice_withDiscount = 252.00, meanbuyprice_withDiscount = 252.00
        , lastbuyprice_withTax = 280, meanbuyprice_withTax = 280, lastbuyprice_withDiscountAndTax = 252
                where sellbilldetailid = 1295;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1780, '2026-10-09', 3360, 3360, 3360
                    , 3360, 3024, 3024, 3024
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3360, 3360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3024, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3024
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3024
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3360, 3360, 3360
                    , 3360, 3024, 3024, 3024
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3360, 3360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3024, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3024
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3024
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-09 20:01:03' WHERE storedetailid = '2793';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1780', '1', '12', '1', '368', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '24', '2', '2026-10-09 20:01:03','0','0'); -- id=4281
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2235128',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('2231768','3360', '0', '2', 'اضافة فاتورة مبيعات', '368', '2235128', '2026-10-09 20:01:03', '2',  'sellbillController.php','1','','0'); -- id=415
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3360', '3360', '2026-10-09', '2', '0', '0', '2026-10-09 20:01:03','اضافة فاتورة مبيعات رقم 368','1','0',null,'0','368','sellbillController.php?do=showDetail&sellbillid=368'); -- id=1883
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1883', '419', '3360', '','0'); -- id=1916
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '2235125', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1883', '143', '3360', '','0'); -- id=1883
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3839145', 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 ( '3024', '3024', '2026-10-09', '2', '0', '0', '2026-10-09 20:01:03','اضافة فاتورة مبيعات رقم 368 - صرف البضاعة من المخزن','1','0',null,'0','368','sellbillController.php?do=showDetail&sellbillid=368'); -- id=1884
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1884', '402', '3024', '','0'); -- id=1917
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3607041.33', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1884', '382', '3024', '','0'); -- id=1884
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20355747.87', 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='1883,0,1884' where sellbillid=368;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 3360, 3360, 3360
                    , 3360, 3024, 3024, 3024
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3360, 3360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3024, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3024
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3024
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3360, 3360, 3360
                    , 3360, 3024, 3024, 3024
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3360, 3360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3024, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3024
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3024
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3360
                        , returnSellVal = returnSellVal+0, 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, 3360, 3360, 3360
                    , 3360, 3024, 3024, 3024, 3360, 3360)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3360, netSellCostBuyPrice = netSellCostBuyPrice+3360
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3360
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3360
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3024
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3024
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3024
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3360
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3360;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac91bad2d281 and sellbillId = 368 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:31:03";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:01:03", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:01:03', '2', 'addsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=6436
UPDATE productunit SET unitid = '1', productid = '1204', productnumber = '1.00', productunitdate = '2026-09-27', userid = '1', conditions = '0',proUnitParcode='',proUnitSellAllPrice='350',proUnitSellHalfPrice='0',proUnitSellUnitPrice ='0',proUnitBuyPrice='330',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '1204';
UPDATE product SET productName = 'شورت جبردين بركان', productDescription = '', productCatId = '58', productBuyPrice = '320', productSellAllPrice = '350', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09490',type ='0', expireDate = '0' , dailyentryId = '559',isService = '0',isOptic = '0',lastbuyprice = '330.00',lastbuyprice_withDiscount = '330',meanbuyprice = '330.00',meanbuyprice_withDiscount = '330' , productbuypricereal = '330' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='330',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9490',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='330',meanbuyprice_withTax='330',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='1',lastbuyprice_withDiscountAndTax='330',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1204';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:31:32";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:01:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-09 20:01:32', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=6437
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('06ac91cd5c0d2f', '2026-10-09 19:56:53', '51', '546030.00', '539310', '0', '0', '-6720.00', '-6720.00', '0', '-6720', '1', '2026-10-09 20:01:32', '', '1', '0', '', '1', '6','1','0.00','-1','0','1','0','0','0','0','0'); -- id=16
INSERT INTO returnbuybilldetail (Parcode, returnbuybillid, returnbuybilldetailcatid, returnbuybilldetailproductid, returnbuybilldetailquantity, returnbuybilldetailprice, returnbuybilldetailtotalprice, discountvalue, note, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid, returnbuybilldetailpriceC, returnbuybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,lastbuyprice_withDiscountAndTax,storeid) VALUES ('09490', '16', '58', '1204', '21', '320', '6720', '0', '', '1204','','','0','0','0','0','0','320','6720','0','0','0','0','0','0','0','1'); -- id=51
UPDATE product SET productName = 'شورت جبردين بركان', productDescription = '', productCatId = '58', productBuyPrice = '320.00', productSellAllPrice = '350.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09490',type ='0', expireDate = '0' , dailyentryId = '559',isService = '0',isOptic = '0',lastbuyprice = '320',lastbuyprice_withDiscount = '320',meanbuyprice = '540',meanbuyprice_withDiscount = '540' , productbuypricereal = '330.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='330',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9490',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='320',meanbuyprice_withTax='540',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='1',lastbuyprice_withDiscountAndTax='320',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1204';
UPDATE returnbuybilldetail SET  lastbuyprice = 320 , meanbuyprice = 540, lastbuyprice_withDiscount = 320, meanbuyprice_withDiscount = 540
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 540, lastbuyprice_withDiscountAndTax = 320
                where returnbuybilldetailid = 51;
UPDATE productunit SET proUnitBuyPrice  = 320 * productnumber WHERE productid = 1204;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-10-09' WHERE storedetailid = '1204';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1204', '1', '21', '1', '16', 'اضافة فاتورة مردودات مشتريات', 'returnBuyBillController.php', '22', '1', '1', '2026-10-09 19:56:53','0','0'); -- id=4282
UPDATE supplier SET  suppliercurrentDebt = '16600',suppliercurrentDebtInCurrency= '539310' , userid = '1', supplierdate = '2026-10-09 20:01:32'   WHERE supplierid = '51';
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 ('51', '23320.00', '6720', '1', 'اضافة فاتورة مردوات مشتريات', '16', '16600', '2026-10-09 19:56:53', '1', 'returnBuyBillController.php', 'اضافة فاتورة مردوات مشتريات', '0','', '0','1','1','6720','1','546030','6720','539310','0',''); -- id=302
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6720', '6720', '2026-10-09', '1', '0', '0', '2026-10-09 20:01:32','اضافة فاتورة مردود مشتريات رقم 16','1','0',null,'0','16','returnBuyBillController.php?do=details&id=16'); -- id=1885
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1885', '470', '6720', '','0'); -- id=1918
UPDATE accountstree SET name = 'المصطفي - مورد', customName = 'المصطفي - مورد', customNameEn = 'المصطفي - مورد', nameEn = 'المصطفي - مورد', parent = '81', accountNature = '1', theValue = '-6720', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '470';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1885', '382', '6720', '','0'); -- id=1885
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20349027.87', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update returnbuybill set dailyentryid='1885,0' where returnbuybillid=16;
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:31:32";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:01:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnBuyBillController.php', '2026-10-09 20:01:32', '1', 'editprint', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/returnBuyBillController.php?do=editprint&id=16'); -- id=6438
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:33:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:03:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 20:03:34', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6439
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:33:41";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:03:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 20:03:41', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6440
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:36:41";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:06:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:06:41', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6441
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:36:56";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:06:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:06:56', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6442
BEGIN;
CALL supplierInUse(5,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('5', '546082.00', '30000', '1', 'ايصال دفع لمورد', '1', '516082', '2026-10-09 20:06:41', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','30000','1','0','0','0','16',''); -- id=303
UPDATE supplierdebtchange SET supplierid = '5', supplierdebtchangebefore = '546082.00', supplierdebtchangeamount = '30000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '516082', supplierdebtchangedate = '2026-10-09 20:06:41', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='30000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='546030',debtchangamountInSupplierCurrency='30000',debtchangafterInSupplierCurrency='516082', paySerialNo='16',tagids='' WHERE supplierdebtchangeid = '303';
UPDATE supplier SET  suppliercurrentDebt = '516082',suppliercurrentDebtInCurrency= '516082' , userid = '1', supplierdate = '2026-10-09 20:06:56'   WHERE supplierid = '5';
UPDATE supplier SET  inUse = 0 where supplierid = 5;
UPDATE save SET  savecurrentvalue = '-1802750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-1772750.00','30000', '1', '1', 'ايصال دفع لمورد', '303', '-1802750', '2026-10-09 20:06:56', '1',  'supplierPayedDeptController.php','0','','0'); -- id=416
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '30000', '30000', '2026-10-09', '1', '0', '0', '2026-10-09 20:06:56','ايصال دفع لمورد ( الونش - مورد ) ','1','0','-1','0','303','supplierReportsController.php?do=show&id=303'); -- id=1886
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1886', '424', '30000', '','0'); -- id=1919
UPDATE accountstree SET name = 'الونش - مورد', customName = 'الونش - مورد', customNameEn = 'الونش - مورد', nameEn = 'الونش - مورد', parent = '81', accountNature = '1', theValue = '-30000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '424';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1886', '383', '30000', '','0'); -- id=1886
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-1802750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '5', supplierdebtchangebefore = '546082.00', supplierdebtchangeamount = '30000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '516082.00', supplierdebtchangedate = '2026-10-09 20:06:41', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '1886',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='30000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='546030',debtchangamountInSupplierCurrency='30000',debtchangafterInSupplierCurrency='516082', paySerialNo='16',tagids='' WHERE supplierdebtchangeid = '303';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:36:56";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:06:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:06:56', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6443
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:36:58";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:06:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:06:58', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6444
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:36:58";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:06:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 20:06:58', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6445
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:37:00";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:07:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:07:00', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6446
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:37:24";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:07:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:07:24', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6447
BEGIN;
CALL supplierInUse(129,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('129', '186000.00', '170000', '1', 'ايصال دفع لمورد', '1', '16000', '2026-10-09 20:07:00', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','170000','1','0','0','0','17',''); -- id=304
UPDATE supplierdebtchange SET supplierid = '129', supplierdebtchangebefore = '186000.00', supplierdebtchangeamount = '170000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '16000', supplierdebtchangedate = '2026-10-09 20:07:00', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='170000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='186000',debtchangamountInSupplierCurrency='170000',debtchangafterInSupplierCurrency='16000', paySerialNo='17',tagids='' WHERE supplierdebtchangeid = '304';
UPDATE supplier SET  suppliercurrentDebt = '16000',suppliercurrentDebtInCurrency= '16000' , userid = '1', supplierdate = '2026-10-09 20:07:24'   WHERE supplierid = '129';
UPDATE supplier SET  inUse = 0 where supplierid = 129;
UPDATE save SET  savecurrentvalue = '-1972750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-1802750.00','170000', '1', '1', 'ايصال دفع لمورد', '304', '-1972750', '2026-10-09 20:07:24', '1',  'supplierPayedDeptController.php','0','','0'); -- id=417
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '170000', '170000', '2026-10-09', '1', '0', '0', '2026-10-09 20:07:24','ايصال دفع لمورد ( الديزل جاكيت ) ','1','0','-1','0','304','supplierReportsController.php?do=show&id=304'); -- id=1887
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1887', '612', '170000', '','0'); -- id=1920
UPDATE accountstree SET name = 'الديزل جاكيت', customName = 'الديزل جاكيت', customNameEn = 'الديزل جاكيت', nameEn = 'الديزل جاكيت', parent = '81', accountNature = '1', theValue = '16000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 15:42:53' WHERE id = '612';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1887', '383', '170000', '','0'); -- id=1887
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-1972750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '129', supplierdebtchangebefore = '186000.00', supplierdebtchangeamount = '170000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '16000.00', supplierdebtchangedate = '2026-10-09 20:07:00', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '1887',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='170000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='186000',debtchangamountInSupplierCurrency='170000',debtchangafterInSupplierCurrency='16000', paySerialNo='17',tagids='' WHERE supplierdebtchangeid = '304';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:37:25";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:07:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:07:25', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6448
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:37:27";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:07:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:07:27', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6449
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:37:27";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:07:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 20:07:27', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6450
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:37:48";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:07:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:07:48', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6451
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:38:42";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:08:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:08:42', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6452
BEGIN;
CALL supplierInUse(48,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('48', '85550.00', '10000', '1', 'ايصال دفع لمورد', '1', '75550', '2026-10-09 20:07:48', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','10000','1','0','0','0','18',''); -- id=305
UPDATE supplierdebtchange SET supplierid = '48', supplierdebtchangebefore = '85550.00', supplierdebtchangeamount = '10000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '75550', supplierdebtchangedate = '2026-10-09 20:07:48', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='10000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='546030',debtchangamountInSupplierCurrency='10000',debtchangafterInSupplierCurrency='75550', paySerialNo='18',tagids='' WHERE supplierdebtchangeid = '305';
UPDATE supplier SET  suppliercurrentDebt = '75550',suppliercurrentDebtInCurrency= '75550' , userid = '1', supplierdate = '2026-10-09 20:08:42'   WHERE supplierid = '48';
UPDATE supplier SET  inUse = 0 where supplierid = 48;
UPDATE save SET  savecurrentvalue = '-1982750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-1972750.00','10000', '1', '1', 'ايصال دفع لمورد', '305', '-1982750', '2026-10-09 20:08:42', '1',  'supplierPayedDeptController.php','0','','0'); -- id=418
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10000', '10000', '2026-10-09', '1', '0', '0', '2026-10-09 20:08:42','ايصال دفع لمورد ( ار ايه جينز - مورد ) ','1','0','-1','0','305','supplierReportsController.php?do=show&id=305'); -- id=1888
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1888', '467', '10000', '','0'); -- id=1921
UPDATE accountstree SET name = 'ار ايه جينز - مورد', customName = 'ار ايه جينز - مورد', customNameEn = 'ار ايه جينز - مورد', nameEn = 'ار ايه جينز - مورد', parent = '81', accountNature = '1', theValue = '-10000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '467';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1888', '383', '10000', '','0'); -- id=1888
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-1982750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '48', supplierdebtchangebefore = '85550.00', supplierdebtchangeamount = '10000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '75550.00', supplierdebtchangedate = '2026-10-09 20:07:48', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '1888',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='10000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='546030',debtchangamountInSupplierCurrency='10000',debtchangafterInSupplierCurrency='75550', paySerialNo='18',tagids='' WHERE supplierdebtchangeid = '305';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:38:42";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:08:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:08:42', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6453
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:38:44";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:08:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:08:44', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6454
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:38:44";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:08:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 20:08:44', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6455
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:38:45";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:08:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:08:45', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6456
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:38:57";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:08:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:08:57', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6457
BEGIN;
CALL supplierInUse(40,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('40', '627480.00', '15000', '1', 'ايصال دفع لمورد', '1', '612480', '2026-10-09 20:08:45', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','15000','1','0','0','0','19',''); -- id=306
UPDATE supplierdebtchange SET supplierid = '40', supplierdebtchangebefore = '627480.00', supplierdebtchangeamount = '15000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '612480', supplierdebtchangedate = '2026-10-09 20:08:45', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='15000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='801770',debtchangamountInSupplierCurrency='15000',debtchangafterInSupplierCurrency='612480', paySerialNo='19',tagids='' WHERE supplierdebtchangeid = '306';
UPDATE supplier SET  suppliercurrentDebt = '612480',suppliercurrentDebtInCurrency= '612480' , userid = '1', supplierdate = '2026-10-09 20:08:57'   WHERE supplierid = '40';
UPDATE supplier SET  inUse = 0 where supplierid = 40;
UPDATE save SET  savecurrentvalue = '-1997750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-1982750.00','15000', '1', '1', 'ايصال دفع لمورد', '306', '-1997750', '2026-10-09 20:08:57', '1',  'supplierPayedDeptController.php','0','','0'); -- id=419
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '15000', '15000', '2026-10-09', '1', '0', '0', '2026-10-09 20:08:57','ايصال دفع لمورد ( كوين - مورد ) ','1','0','-1','0','306','supplierReportsController.php?do=show&id=306'); -- id=1889
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1889', '459', '15000', '','0'); -- id=1922
UPDATE accountstree SET name = 'كوين - مورد', customName = 'كوين - مورد', customNameEn = 'كوين - مورد', nameEn = 'كوين - مورد', parent = '81', accountNature = '1', theValue = '240740', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '459';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1889', '383', '15000', '','0'); -- id=1889
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-1997750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '40', supplierdebtchangebefore = '627480.00', supplierdebtchangeamount = '15000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '612480.00', supplierdebtchangedate = '2026-10-09 20:08:45', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '1889',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='15000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='801770',debtchangamountInSupplierCurrency='15000',debtchangafterInSupplierCurrency='612480', paySerialNo='19',tagids='' WHERE supplierdebtchangeid = '306';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:38:57";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:08:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:08:57', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6458
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:38:59";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:08:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:08:59', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6459
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:38:59";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:08:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 20:08:59', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6460
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:39:00";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:09:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:09:00', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6461
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:39:16";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:09:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:09:16', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6462
BEGIN;
CALL supplierInUse(106,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('106', '628290.00', '200000', '1', 'ايصال دفع لمورد', '1', '428290', '2026-10-09 20:09:00', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','200000','1','0','0','0','20',''); -- id=307
UPDATE supplierdebtchange SET supplierid = '106', supplierdebtchangebefore = '628290.00', supplierdebtchangeamount = '200000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '428290', supplierdebtchangedate = '2026-10-09 20:09:00', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='200000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='628290',debtchangamountInSupplierCurrency='200000',debtchangafterInSupplierCurrency='428290', paySerialNo='20',tagids='' WHERE supplierdebtchangeid = '307';
UPDATE supplier SET  suppliercurrentDebt = '428290',suppliercurrentDebtInCurrency= '428290' , userid = '1', supplierdate = '2026-10-09 20:09:16'   WHERE supplierid = '106';
UPDATE supplier SET  inUse = 0 where supplierid = 106;
UPDATE save SET  savecurrentvalue = '-2197750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-1997750.00','200000', '1', '1', 'ايصال دفع لمورد', '307', '-2197750', '2026-10-09 20:09:16', '1',  'supplierPayedDeptController.php','0','','0'); -- id=420
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '200000', '200000', '2026-10-09', '1', '0', '0', '2026-10-09 20:09:16','ايصال دفع لمورد ( تمبو ) ','1','0','-1','0','307','supplierReportsController.php?do=show&id=307'); -- id=1890
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1890', '589', '200000', '','0'); -- id=1923
UPDATE accountstree SET name = 'تمبو', customName = 'تمبو', customNameEn = 'تمبو', nameEn = 'تمبو', parent = '81', accountNature = '1', theValue = '428290', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-07 09:33:15' WHERE id = '589';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1890', '383', '200000', '','0'); -- id=1890
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2197750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '106', supplierdebtchangebefore = '628290.00', supplierdebtchangeamount = '200000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '428290.00', supplierdebtchangedate = '2026-10-09 20:09:00', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '1890',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='200000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='628290',debtchangamountInSupplierCurrency='200000',debtchangafterInSupplierCurrency='428290', paySerialNo='20',tagids='' WHERE supplierdebtchangeid = '307';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:39:16";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:09:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:09:16', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6463
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:39:18";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:09:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:09:18', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6464
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:39:18";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:09:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 20:09:18', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6465
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:39:28";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:09:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:09:28', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php'); -- id=6466
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:39:40";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:09:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:09:40', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=6467
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:39:56";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:09:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:09:56', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6468
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:41:02";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:11:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:11:02', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6469
BEGIN;
BEGIN;
CALL clientInUse(38,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '656005' , clientdate = '2026-10-09 20:11:02', 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','526005.00','130000','0','ايصال دفع لعميل','478', '656005', '2026-10-09 20:11:02', '1', 'clientPayedDeptController.php', 'ايصال دفع لعميل', '130000', '0', null, '0', null, null,'', '0','1','1','130000','1','','478','0','',''); -- id=478
UPDATE save SET  savecurrentvalue = '-2327750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2197750.00','130000', '1', '1', 'ايصال دفع لعميل', '478', '-2327750', '2026-10-09 20:11:02', '1',  'clientPayedDeptController.php','0','','0'); -- id=421
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '130000', '130000', '2026-10-09', '1', '0', '0', '2026-10-09 20:11:02','ايصال دفع لعميل ( عبده كوكو -العملاء ) ','1','0','-1','0','478','clientPayedDeptController.php?do=show&id=478'); -- id=1891
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1891', '536', '130000', '','0'); -- id=1924
UPDATE accountstree SET name = 'عبده كوكو -العملاء', customName = 'عبده كوكو -العملاء', customNameEn = 'عبده كوكو -العملاء', nameEn = 'عبده كوكو -العملاء', parent = '58', accountNature = '0', theValue = '491355', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '536';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1891', '383', '130000', '','0'); -- id=1891
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2327750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE clientdebtchange SET clientid = '38', clientdebtchangebefore = '526005.00', clientdebtchangeamount = '130000', clientdebtchangetype = '0', processname = 'ايصال دفع لعميل', clientdebtchangemodelid = '478', clientdebtchangeafter = '656005', clientdebtchangedate = '2026-10-09 20:11:02', userid = '1', tablename = 'clientPayedDeptController.php', comment = 'ايصال دفع لعميل', totalOperationCost = '130000',discount='', reciptid='0', dailyentryid = '0',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='130000',saveConversionFactor='1',totalpayments='0',tagids='',file='' WHERE clientdebtchangeid = '478';
COMMIT;
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:41:03";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:11:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:11:03', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6470
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:41:04";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:11:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:11:04', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6471
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:41:04";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:11:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 20:11:04', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6472
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:41:12";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:11:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:11:12', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php'); -- id=6473
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:41:21";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:11:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:11:21', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=6474
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:42:33";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:12:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:12:33', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php'); -- id=6475
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:42:41";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:12:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:12:41', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=6476
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:43:25";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:13:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:13:25', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php'); -- id=6477
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:43:30";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:13:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:13:30', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6478
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:43:54";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:13:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 20:13:54', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6479
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:43:56";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:13:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:13:56', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php'); -- id=6480
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:44:03";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:14:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:14:03', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=6481
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:44:08";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:14:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:14:08', '1', 'editprint', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=editprint&id=152'); -- id=6482
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:44:08";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:14:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:14:08', '1', 'editprint', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=editprint&id=152'); -- id=6483
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:45:23";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:15:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:15:23', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6484
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:46:52";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:16:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:16:52', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php'); -- id=6485
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:46:59";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:16:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:16:59', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=6486
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:47:20";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:17:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:17:20', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=6487
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:47:36";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:17:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:17:36', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=6488
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:47:55";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:17:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 20:17:55', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6489
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:47:55";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 20:17:55', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6490
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 blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:48:25";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:18:25", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 20:18:25', '1', '', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6491
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:48:25";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 20:18:25', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6492
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:48:28";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:18:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientDeficitController.php', '2026-10-09 20:18:28', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientDeficitController.php'); -- id=6493
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:48:29";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:18:29", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:18:29', '1', '', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php'); -- id=6494
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:48:43";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:18:43", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:18:43', '1', 'show', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=6495
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:48:48";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:18:48", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:18:48', '1', 'editprint', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=editprint&id=478'); -- id=6496
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:49:13";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:19:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientDeficitController.php', '2026-10-09 20:19:13', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientDeficitController.php?do=add'); -- id=6497

-- ----------------------------------------------------------------------------------------------------
-- clientDeficitController add - with clientid =38
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(38,@clientdebt,@clientname,@treeIdis);
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','656005.00','210000','1','تسوية عجز عميل بالخصم','-1', '446005', '2026-10-09 20:19:13', '1', 'clientDeficitController.php', '', '210000', '0', null, '0', null, null,'', '0','1','1','210000','1','','0','0','',''); -- id=479
UPDATE client SET  clientdebt = '446005' , clientdate = '2026-10-09', userid = '1' WHERE clientid = '38';
UPDATE client SET  inUse = 0 where clientid = 38;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '210000', '210000', '2026-10-09', '1', '0', '0', '2026-10-09 20:19:13','تم اضافة معالجة عجز للعميل عبده كوكو -العملاء(تسوية بالخصم)','1','0','-1','0','0',''); -- id=1892
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1892', '398', '210000', '','0'); -- id=1925
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '348038', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1892', '536', '210000', '','0'); -- id=1892
UPDATE accountstree SET name = 'عبده كوكو -العملاء', customName = 'عبده كوكو -العملاء', customNameEn = 'عبده كوكو -العملاء', nameEn = 'عبده كوكو -العملاء', parent = '58', accountNature = '0', theValue = '281355', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '536';
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- clientDeficitController add end- with clientid =38 ,id=479
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:49:14";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:19:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientDeficitController.php', '2026-10-09 20:19:14', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientDeficitController.php?do=sucess'); -- id=6498
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:49:16";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:19:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientDeficitController.php', '2026-10-09 20:19:16', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientDeficitController.php?do=show'); -- id=6499
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:49:17";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:19:17", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:19:17', '1', 'show', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=show'); -- id=6500
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:49:17";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:19:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:19:17', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php'); -- id=6501
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:49:36";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:19:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:19:36', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=add'); -- id=6502

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =480
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(38,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '366005' , clientdate = '2026-10-09 20:19:36', 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','446005.00','80000','1','ايصال تحصيل (( قبض من عميل ))','480', '366005', '2026-10-09 20:19:17', '1', 'clientPayedDeptController.php', '   ', '80000', '0', null, '0', null, null,'', '-1','1','1','80000','1','','479','0','','.'); -- id=480
UPDATE save SET  savecurrentvalue = '-2247750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2327750.00','80000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '480', '-2247750', '2026-10-09 20:19:36', '1',  'clientPayedDeptController.php','38','','0'); -- id=422
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '80000', '80000', '2026-10-09', '1', '0', '0', '2026-10-09 20:19:36','اضافة ايصال سداد للعميل عبده كوكو -العملاء','1','0','-1','0','480','clientPayedDeptController.php?do=show&id=480'); -- id=1893
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1893', '383', '80000', '','0'); -- id=1926
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2247750', 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 ('1893', '536', '80000', '','0'); -- id=1893
UPDATE accountstree SET name = 'عبده كوكو -العملاء', customName = 'عبده كوكو -العملاء', customNameEn = 'عبده كوكو -العملاء', nameEn = 'عبده كوكو -العملاء', parent = '58', accountNature = '0', theValue = '201355', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '536';
UPDATE clientdebtchange SET clientid = '38', clientdebtchangebefore = '446005.000', clientdebtchangeamount = '80000.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '480', clientdebtchangeafter = '366005.000', clientdebtchangedate = '2026-10-09 20:19:17', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '80000.000',discount='', reciptid='0', dailyentryid = '1893',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='80000',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '480';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:49:36";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:19:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:19:36', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php'); -- id=6503
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:49:36";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('dailyentry.php', '2026-10-09 20:19:36', '1', '', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/dailyentry.php?id=0'); -- id=6504
BEGIN;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:49:37";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:19:37", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 20:19:37', '1', '', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6505
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:49:37";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 20:19:37', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6506
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:49:44";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:19:44", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:19:44', '1', 'editprint2', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=editprint2&id=478'); -- id=6507
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:50:09";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:20:09", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 20:20:09', '1', '', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6508
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:50:27";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:20:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:20:27', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=add'); -- id=6509

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =481
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(38,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '236005' , clientdate = '2026-10-09 20:20:27', 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','366005.00','130000','1','ايصال تحصيل (( قبض من عميل ))','481', '236005', '2026-10-09 20:19:36', '1', 'clientPayedDeptController.php', '   ', '130000', '0', null, '0', null, null,'', '-1','1','1','130000','1','','480','0','','.'); -- id=481
UPDATE save SET  savecurrentvalue = '-2117750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2247750.00','130000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '481', '-2117750', '2026-10-09 20:20:27', '1',  'clientPayedDeptController.php','38','','0'); -- id=423
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '130000', '130000', '2026-10-09', '1', '0', '0', '2026-10-09 20:20:27','اضافة ايصال سداد للعميل عبده كوكو -العملاء','1','0','-1','0','481','clientPayedDeptController.php?do=show&id=481'); -- id=1894
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1894', '383', '130000', '','0'); -- id=1927
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2117750', 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 ('1894', '536', '130000', '','0'); -- id=1894
UPDATE accountstree SET name = 'عبده كوكو -العملاء', customName = 'عبده كوكو -العملاء', customNameEn = 'عبده كوكو -العملاء', nameEn = 'عبده كوكو -العملاء', parent = '58', accountNature = '0', theValue = '71355', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '536';
UPDATE clientdebtchange SET clientid = '38', clientdebtchangebefore = '366005.000', clientdebtchangeamount = '130000.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '481', clientdebtchangeafter = '236005.000', clientdebtchangedate = '2026-10-09 20:19:36', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '130000.000',discount='', reciptid='0', dailyentryid = '1894',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='130000',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '481';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:50:27";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:20:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:20:27', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php'); -- id=6510
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:50:40";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:20:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 20:20:40', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6511
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:50:40";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 20:20:41', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6512
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:50:52";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:20:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientDeficitController.php', '2026-10-09 20:20:52', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientDeficitController.php'); -- id=6513
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:51:09";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:21:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientDeficitController.php', '2026-10-09 20:21:09', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientDeficitController.php?do=add'); -- id=6514

-- ----------------------------------------------------------------------------------------------------
-- clientDeficitController add - with clientid =40
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(40,@clientdebt,@clientname,@treeIdis);
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('40','151885.00','50000','1','تسوية عجز عميل بالخصم','-1', '101885', '2026-10-09 20:21:09', '1', 'clientDeficitController.php', '', '50000', '0', null, '0', null, null,'', '0','1','1','50000','1','','0','0','',''); -- id=482
UPDATE client SET  clientdebt = '101885' , clientdate = '2026-10-09', userid = '1' WHERE clientid = '40';
UPDATE client SET  inUse = 0 where clientid = 40;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 20:21:09','تم اضافة معالجة عجز للعميل الطوخي - عميل(تسوية بالخصم)','1','0','-1','0','0',''); -- id=1895
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1895', '398', '50000', '','0'); -- id=1928
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '398038', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1895', '538', '50000', '','0'); -- id=1895
UPDATE accountstree SET name = 'الطوخي - عميل', customName = 'الطوخي - عميل', customNameEn = 'الطوخي - عميل', nameEn = 'الطوخي - عميل', parent = '58', accountNature = '0', theValue = '87540', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '538';
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- clientDeficitController add end- with clientid =40 ,id=482
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:51:09";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:21:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientDeficitController.php', '2026-10-09 20:21:09', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientDeficitController.php?do=sucess'); -- id=6515
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:51:10";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:21:10", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 20:21:10', '1', 'show', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/savedailyController.php?do=show'); -- id=6516
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:51:11";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:21:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientDeficitController.php', '2026-10-09 20:21:11', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientDeficitController.php?do=show'); -- id=6517
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:51:17";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:21:17", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:21:17', '1', '', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php'); -- id=6518
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:51:27";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:21:27", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:21:27', '1', 'show', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=6519
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:51:40";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:21:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:21:40', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=add'); -- id=6520

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =482
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(40,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '51885' , clientdate = '2026-10-09 20:21:40', userid = '1' WHERE clientid = '40';
UPDATE client SET  inUse = 0 where clientid = 40;
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('40','101885.00','50000','1','ايصال تحصيل (( قبض من عميل ))','482', '51885', '2026-10-09 20:20:27', '1', 'clientPayedDeptController.php', '   ', '50000', '0', null, '0', null, null,'', '-1','1','1','50000','1','','481','0','','.'); -- id=483
UPDATE save SET  savecurrentvalue = '-2067750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2117750.00','50000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '483', '-2067750', '2026-10-09 20:21:40', '1',  'clientPayedDeptController.php','40','','0'); -- id=424
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 20:21:40','اضافة ايصال سداد للعميل الطوخي - عميل','1','0','-1','0','483','clientPayedDeptController.php?do=show&id=483'); -- id=1896
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1896', '383', '50000', '','0'); -- id=1929
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2067750', 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 ('1896', '538', '50000', '','0'); -- id=1896
UPDATE accountstree SET name = 'الطوخي - عميل', customName = 'الطوخي - عميل', customNameEn = 'الطوخي - عميل', nameEn = 'الطوخي - عميل', parent = '58', accountNature = '0', theValue = '37540', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '538';
UPDATE clientdebtchange SET clientid = '40', clientdebtchangebefore = '101885.000', clientdebtchangeamount = '50000.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '482', clientdebtchangeafter = '51885.000', clientdebtchangedate = '2026-10-09 20:20:27', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '50000.000',discount='', reciptid='0', dailyentryid = '1896',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '483';
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add end - with modelid =482 -clientdebtchangeId = 483
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:51:40";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:21:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:21:40', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php'); -- id=6521
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:51:48";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:21:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:21:48', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6522
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:52:06";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:52:07";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:52:07";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:22:07", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:22:07', '1', '', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php'); -- id=6523
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:52:10";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:22:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 20:22:10', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6524
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:52:10";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 20:22:10', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6525
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:52:35";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:22:35", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 20:22:35', '1', '', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6526
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:52:35";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 20:22:35', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6527
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:52:42";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:55:00";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:25:00", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:25:00', '1', '', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php'); -- id=6528
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:55:11";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:25:11", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:25:11', '1', 'show', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=6529
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:55:45";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:55:48";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:25:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 20:25:48', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6530
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:55:48";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 20:25:48', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6531
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:56:14";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:56:49";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:26:49", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:26:49', '1', '', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php'); -- id=6532
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:57:09";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:27:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:27:09', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6533
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:57:44";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:27:44", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:27:44', '1', '', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6534
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:58:03";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:28:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:28:03', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6535
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:58:12";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:28:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:28:12', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6536
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:58:38";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:28:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:28:38', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6537
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:58:51";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:28:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:28:51', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6538
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:59:02";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:29:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:29:02', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6539
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:59:15";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:29:15", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-09 20:29:15', '1', '', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=6540
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 16:59:59";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:29:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:29:59', '1', 'editsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=269'); -- id=6541
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:00:11";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:30:11", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:30:11', '1', 'editprint', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=editprint&id=478'); -- id=6542
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:00:14";
UPDATE user SET loginip = "196.134.30.241", lastactivetime = "2026-10-09 20:30:14", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storereportController.php', '2026-10-09 20:30:14', '1', '', '196.134.30.241', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/storereportController.php'); -- id=6543
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:00:18";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:30:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:30:18', '1', 'update', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=update'); -- id=6544
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 269;
UPDATE sellbill SET  sellbillsysdate = '2026-10-09 20:30:18', userid = '2',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '269';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 505;
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 362.70, meanbuyprice_withDiscount = 362.70
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 362.7
                where sellbilldetailid = 1005;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1659, '2026-10-09', 1169.7669786895, 1170, 1170
                    , 1170, 1088.1, 1088.1, 1088.1
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1169.7669786895, sellCostBuyPrice =sellCostBuyPrice-1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1088.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1088.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1088.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1170
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1169.7669786895, 1170, 1170
                    , 1170, 1088.1, 1088.1, 1088.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1169.7669786895, sellCostBuyPrice =sellCostBuyPrice-1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1088.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1088.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1088.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1170
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '168', userid = '1', storedetaildate = '2026-10-09 20:30:18' WHERE storedetailid = '2671';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1659', '1', '3', '0', '269', 'تعديل فاتورة مبيعات', 'sellbillController.php', '165', '168', '1', '2026-10-09 09:59:13','0','0'); -- id=4283
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-9 where id = 71;
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1006;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-09', 2699.4622585142, 2430, 2430
                    , 2430, 2430, 2430, 2430
                    , 0, 0, 0, 0
                    , 0, 0, 0,9,0, 2430, 2430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2699.4622585142, sellCostBuyPrice =sellCostBuyPrice-2430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2430, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2430
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-9
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2699.4622585142, 2430, 2430
                    , 2430, 2430, 2430, 2430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2430, 2430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2699.4622585142, sellCostBuyPrice =sellCostBuyPrice-2430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2430, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2430
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '624', userid = '1', storedetaildate = '2026-10-09 20:30:18' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '9', '0', '269', 'تعديل فاتورة مبيعات', 'sellbillController.php', '615', '624', '1', '2026-10-09 09:59:13','0','0'); -- id=4284
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 71;
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1007;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-09', 899.82075283808, 810, 810
                    , 810, 810, 810, 810
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 810, 810, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-899.82075283808, sellCostBuyPrice =sellCostBuyPrice-810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-810, sellCostMeanBuyPrice = sellCostMeanBuyPrice-810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-810
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-810
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-810
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 899.82075283808, 810, 810
                    , 810, 810, 810, 810
                    , 0, 0, 0, 0
                    , 0, 0, 0, 810, 810, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-899.82075283808, sellCostBuyPrice =sellCostBuyPrice-810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-810, sellCostMeanBuyPrice = sellCostMeanBuyPrice-810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-810
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-810
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-810
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '627', userid = '1', storedetaildate = '2026-10-09 20:30:18' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '3', '0', '269', 'تعديل فاتورة مبيعات', 'sellbillController.php', '624', '627', '1', '2026-10-09 09:59:13','0','0'); -- id=4285
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-18 where id = 282;
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 288.00, meanbuyprice_withDiscount = 288.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 288
                where sellbilldetailid = 1008;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1472, '2026-10-09', 5758.8528181637, 5760, 5760
                    , 5760, 5184, 5184, 5184
                    , 0, 0, 0, 0
                    , 0, 0, 0,18,0, 5760, 5760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5758.8528181637, sellCostBuyPrice =sellCostBuyPrice-5760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5760, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5184, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5184
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5184
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5760
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-18
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5758.8528181637, 5760, 5760
                    , 5760, 5184, 5184, 5184
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5760, 5760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5758.8528181637, sellCostBuyPrice =sellCostBuyPrice-5760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5760, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5184, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5184
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5184
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5760
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-10-09 20:30:18' WHERE storedetailid = '1497';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1472', '1', '18', '0', '269', 'تعديل فاتورة مبيعات', 'sellbillController.php', '63', '81', '1', '2026-10-09 09:59:13','0','0'); -- id=4286
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 74;
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1009;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1382, '2026-10-09', 2399.5220075682, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2399.5220075682, sellCostBuyPrice =sellCostBuyPrice-2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2160
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2399.5220075682, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2399.5220075682, sellCostBuyPrice =sellCostBuyPrice-2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2160
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '57', userid = '1', storedetaildate = '2026-10-09 20:30:18' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '6', '0', '269', 'تعديل فاتورة مبيعات', 'sellbillController.php', '51', '57', '1', '2026-10-09 09:59:13','0','0'); -- id=4287
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 72;
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1010;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-09', 2339.533957379, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2339.533957379, sellCostBuyPrice =sellCostBuyPrice-2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2100
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2339.533957379, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2339.533957379, sellCostBuyPrice =sellCostBuyPrice-2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2100
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '576', userid = '1', storedetaildate = '2026-10-09 20:30:18' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '6', '0', '269', 'تعديل فاتورة مبيعات', 'sellbillController.php', '570', '576', '1', '2026-10-09 09:59:13','0','0'); -- id=4288
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-9 where id = 72;
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1011;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-09', 3509.3009360685, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0,9,0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3509.3009360685, sellCostBuyPrice =sellCostBuyPrice-3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3150
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-9
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3509.3009360685, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3509.3009360685, sellCostBuyPrice =sellCostBuyPrice-3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3150
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '585', userid = '1', storedetaildate = '2026-10-09 20:30:18' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '9', '0', '269', 'تعديل فاتورة مبيعات', 'sellbillController.php', '576', '585', '1', '2026-10-09 09:59:13','0','0'); -- id=4289
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 73;
UPDATE sellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.00
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260, lastbuyprice_withDiscountAndTax = 260
                where sellbilldetailid = 1012;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1381, '2026-10-09', 884.82374029078, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-884.82374029078, sellCostBuyPrice =sellCostBuyPrice-780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-780, sellCostMeanBuyPrice = sellCostMeanBuyPrice-780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-780
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 884.82374029078, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-884.82374029078, 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 = '297', userid = '1', storedetaildate = '2026-10-09 20:30:18' WHERE storedetailid = '1381';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1381', '1', '3', '0', '269', 'تعديل فاتورة مبيعات', 'sellbillController.php', '294', '297', '1', '2026-10-09 09:59:13','0','0'); -- id=4290
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-16 where id = 355;
UPDATE sellbilldetail SET  lastbuyprice = 276.00 , meanbuyprice = 276.00, lastbuyprice_withDiscount = 276.00, meanbuyprice_withDiscount = 276.00
        , lastbuyprice_withTax = 276, meanbuyprice_withTax = 276, lastbuyprice_withDiscountAndTax = 276
                where sellbilldetailid = 1013;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1467, '2026-10-09', 5438.916550488, 4416, 4416
                    , 4416, 4416, 4416, 4416
                    , 0, 0, 0, 0
                    , 0, 0, 0,16,0, 4416, 4416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5438.916550488, sellCostBuyPrice =sellCostBuyPrice-4416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4416, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4416
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-16
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5438.916550488, 4416, 4416
                    , 4416, 4416, 4416, 4416
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4416, 4416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5438.916550488, sellCostBuyPrice =sellCostBuyPrice-4416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4416, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4416
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '680', userid = '1', storedetaildate = '2026-10-09 20:30:18' WHERE storedetailid = '1492';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1467', '1', '16', '0', '269', 'تعديل فاتورة مبيعات', 'sellbillController.php', '664', '680', '1', '2026-10-09 09:59:13','0','0'); -- id=4291
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0.00','1','تعديل فاتورة مبيعات','269', '0', '2026-10-09 09:59:13', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '25100', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:59:13','0','0','',''); -- id=484
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2210028',  userid = '1' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('2235128','25100', '1', '2', 'تعديل فاتورة مبيعات', '269', '2210028', '2026-10-09 20:30:18', '1',  'sellbillController.php','1','','0'); -- id=425
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 25100, 22776, 22776
                    , 22776, 22118.1, 22118.1, 22118.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,22776, 22776, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-25100, sellCostBuyPrice =sellCostBuyPrice-22776
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-22776, sellCostMeanBuyPrice = sellCostMeanBuyPrice-22776
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-22118.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-22118.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-22118.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-22776
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-22776
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 25100, 22776, 22776
                    , 22776, 22118.1, 22118.1, 22118.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22776, 22776, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-25100, sellCostBuyPrice =sellCostBuyPrice-22776
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-22776, sellCostMeanBuyPrice = sellCostMeanBuyPrice-22776
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-22118.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-22118.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-22118.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-22776
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-22776
                        , returnSellVal = returnSellVal-0, 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, 25100, 22776, 22776
                    , 22776, 22118.1, 22118.1, 22118.1, 22776, 22776)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-25100, netSellCostBuyPrice = netSellCostBuyPrice-22776
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-22776
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-22776
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-22118.1
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-22118.1
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-22118.1
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-22776
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-22776;

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


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

COMMIT;
BEGIN;
CALL clientInUse(31,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:59:13', '06ac88db765507', '31', '777550.00', '802650', '5', '1', '25105', '25100', '0', '25100', '1', '2026-10-09 09:59:13', '', '1', '0', 'التركي - عميل', '2', '1', '3', '0', 'التركي - عميل', '73', '269', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-09','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=369
UPDATE client SET  clientdebt = '802650', userid = '1' WHERE clientid = '31';
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 ('31','777550.00','25100','0','اضافة فاتورة مبيعات (معدله)','369', '802650', '2026-10-09 20:30:18', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '25100', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:59:13','0','0','',''); -- id=485
UPDATE client SET  inUse = 0 where clientid = 31;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 505;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('362.7','01659', '369', '125', '1659', '3.00', '390', '1170', '0', '', '0', '2026-10-09 20:30:18', '1659', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','505-3,','1','1','0','0','390','1170','0','','0','0.00','0','0','0','0'); -- id=1296
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 362.70, meanbuyprice_withDiscount = 362.70
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 362.7
                where sellbilldetailid = 1296;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1659, '2026-10-09', 1169.7669786895, 1170, 1170
                    , 1170, 1088.1, 1088.1, 1088.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1169.7669786895, sellCostBuyPrice =sellCostBuyPrice+1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1088.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1088.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1088.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1170
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1169.7669786895, 1170, 1170
                    , 1170, 1088.1, 1088.1, 1088.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1169.7669786895, sellCostBuyPrice =sellCostBuyPrice+1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1088.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1088.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1088.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1170
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '165', userid = '1', storedetaildate = '2026-10-09 20:30:18' WHERE storedetailid = '2671';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1659', '1', '3', '1', '369', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '168', '165', '1', '2026-10-09 20:30:18','0','0'); -- id=4292
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','01379', '369', '94', '1379', '9.00', '300', '2700', '0', '', '0', '2026-10-09 20:30:18', '1379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','71-9,','1','1','0','0','300','2700','0','','0','0.00','0','0','0','0'); -- id=1297
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1297;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-09', 2699.4622585142, 2430, 2430
                    , 2430, 2430, 2430, 2430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2430, 2430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2699.4622585142, sellCostBuyPrice =sellCostBuyPrice+2430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2699.4622585142, 2430, 2430
                    , 2430, 2430, 2430, 2430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2430, 2430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2699.4622585142, sellCostBuyPrice =sellCostBuyPrice+2430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '618', userid = '1', storedetaildate = '2026-10-09 20:30:18' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '9', '1', '369', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '627', '618', '1', '2026-10-09 20:30:18','0','0'); -- id=4293
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','01379', '369', '94', '1379', '3.00', '300', '900', '0', '', '0', '2026-10-09 20:30:18', '1379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','71-3,','1','1','0','0','300','900','0','','0','0.00','0','0','0','0'); -- id=1298
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1298;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-09', 899.82075283808, 810, 810
                    , 810, 810, 810, 810
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 810, 810, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+899.82075283808, sellCostBuyPrice =sellCostBuyPrice+810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+810, sellCostMeanBuyPrice = sellCostMeanBuyPrice+810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+810
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+810
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+810
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 899.82075283808, 810, 810
                    , 810, 810, 810, 810
                    , 0, 0, 0, 0
                    , 0, 0, 0, 810, 810, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+899.82075283808, sellCostBuyPrice =sellCostBuyPrice+810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+810, sellCostMeanBuyPrice = sellCostMeanBuyPrice+810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+810
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+810
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+810
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '615', userid = '1', storedetaildate = '2026-10-09 20:30:18' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '3', '1', '369', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '618', '615', '1', '2026-10-09 20:30:18','0','0'); -- id=4294
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+18 where id = 282;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('288','01472', '369', '105', '1472', '18.00', '320', '5760', '0', '', '0', '2026-10-09 20:30:18', '1472', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','282-18,','1','1','0','0','320','5760','0','','0','0.00','0','0','0','0'); -- id=1299
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 288.00, meanbuyprice_withDiscount = 288.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 288
                where sellbilldetailid = 1299;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1472, '2026-10-09', 5758.8528181637, 5760, 5760
                    , 5760, 5184, 5184, 5184
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 0, 5760, 5760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5758.8528181637, sellCostBuyPrice =sellCostBuyPrice+5760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5184, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5184
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5184
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+18
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5758.8528181637, 5760, 5760
                    , 5760, 5184, 5184, 5184
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5760, 5760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5758.8528181637, sellCostBuyPrice =sellCostBuyPrice+5760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5184, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5184
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5184
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '63', userid = '1', storedetaildate = '2026-10-09 20:30:18' WHERE storedetailid = '1497';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1472', '1', '18', '1', '369', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '81', '63', '1', '2026-10-09 20:30:18','0','0'); -- id=4295
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 74;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','01382', '369', '94', '1382', '6.00', '400', '2400', '0', '', '0', '2026-10-09 20:30:18', '1382', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','74-6,','1','1','0','0','400','2400','0','','0','0.00','0','0','0','0'); -- id=1300
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1300;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1382, '2026-10-09', 2399.5220075682, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2399.5220075682, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2399.5220075682, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2399.5220075682, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '51', userid = '1', storedetaildate = '2026-10-09 20:30:18' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '6', '1', '369', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '57', '51', '1', '2026-10-09 20:30:18','0','0'); -- id=4296
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 72;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01380', '369', '94', '1380', '6.00', '390', '2340', '0', '', '0', '2026-10-09 20:30:18', '1380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','72-6,','1','1','0','0','390','2340','0','','0','0.00','0','0','0','0'); -- id=1301
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1301;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-09', 2339.533957379, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2339.533957379, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2339.533957379, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2339.533957379, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '579', userid = '1', storedetaildate = '2026-10-09 20:30:18' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '6', '1', '369', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '585', '579', '1', '2026-10-09 20:30:18','0','0'); -- id=4297
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 72;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01380', '369', '94', '1380', '9.00', '390', '3510', '0', '', '0', '2026-10-09 20:30:18', '1380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','72-9,','1','1','0','0','390','3510','0','','0','0.00','0','0','0','0'); -- id=1302
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1302;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-09', 3509.3009360685, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3509.3009360685, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3509.3009360685, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3509.3009360685, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '570', userid = '1', storedetaildate = '2026-10-09 20:30:18' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '9', '1', '369', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '579', '570', '1', '2026-10-09 20:30:18','0','0'); -- id=4298
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 73;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('260','01381', '369', '94', '1381', '3.00', '295', '885', '0', '', '0', '2026-10-09 20:30:18', '1381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','73-3,','1','1','0','0','295','885','0','','0','0.00','0','0','0','0'); -- id=1303
UPDATE sellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.00
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260, lastbuyprice_withDiscountAndTax = 260
                where sellbilldetailid = 1303;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1381, '2026-10-09', 884.82374029078, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+884.82374029078, sellCostBuyPrice =sellCostBuyPrice+780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 884.82374029078, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+884.82374029078, 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 = '294', userid = '1', storedetaildate = '2026-10-09 20:30:18' WHERE storedetailid = '1381';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1381', '1', '3', '1', '369', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '297', '294', '1', '2026-10-09 20:30:18','0','0'); -- id=4299
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+16 where id = 355;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('276','01467', '369', '104', '1467', '16.00', '340', '5440', '0', '', '0', '2026-10-09 20:30:18', '1467', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','355-16,','1','1','0','0','340','5440','0','','0','0.00','0','0','0','0'); -- id=1304
UPDATE sellbilldetail SET  lastbuyprice = 276.00 , meanbuyprice = 276.00, lastbuyprice_withDiscount = 276.00, meanbuyprice_withDiscount = 276.00
        , lastbuyprice_withTax = 276, meanbuyprice_withTax = 276, lastbuyprice_withDiscountAndTax = 276
                where sellbilldetailid = 1304;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1467, '2026-10-09', 5438.916550488, 4416, 4416
                    , 4416, 4416, 4416, 4416
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 4416, 4416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5438.916550488, sellCostBuyPrice =sellCostBuyPrice+4416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4416, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4416
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5438.916550488, 4416, 4416
                    , 4416, 4416, 4416, 4416
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4416, 4416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5438.916550488, sellCostBuyPrice =sellCostBuyPrice+4416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4416, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4416
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '664', userid = '1', storedetaildate = '2026-10-09 20:30:18' WHERE storedetailid = '1492';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1467', '1', '16', '1', '369', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '680', '664', '1', '2026-10-09 20:30:18','0','0'); -- id=4300
UPDATE dailyentry SET totalcreditor = '25105.00', totaldebtor = '25105.00', thedate = '2026-10-09', userid = '2', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 09:59:13', entryComment = 'اضافة فاتورة مبيعات رقم 269', fromFlag = '1',related='0',isopeningentry='0',operationId='269',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=269' WHERE id = '1659';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '25105.00', '25105.00', '2026-10-09', '1', '0', '1659', '2026-10-09 20:30:18','تم عكس القيد رقم 1659 ','1','0','-1','0','0',''); -- id=1897
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1897', '419', '25100.00', '','0'); -- id=1897
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '2210025', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1897', '398', '5.00', '','0'); -- id=1898
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '398033', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1897', '143', '25105.00', '','0'); -- id=1930
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3814040', 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 = '22118.10', totaldebtor = '22118.10', thedate = '2026-10-09', userid = '2', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 09:59:13', entryComment = 'اضافة فاتورة مبيعات رقم 269 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='269',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=269' WHERE id = '1660';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '22118.10', '22118.10', '2026-10-09', '1', '0', '1660', '2026-10-09 20:30:18','تم عكس القيد رقم 1660 ','1','0','-1','0','0',''); -- id=1898
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1898', '402', '22118.10', '','0'); -- id=1899
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3584923.23', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1898', '382', '22118.10', '','0'); -- id=1931
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20371145.97', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '25105', '25105', '2026-10-09', '1', '0', '0', '2026-10-09 20:30:18','اضافة فاتورة مبيعات رقم 369','1','0',null,'0','369','sellbillController.php?do=showDetail&sellbillid=369'); -- id=1899
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1899', '529', '25100', '','0'); -- id=1932
UPDATE accountstree SET name = 'التركي - عميل', customName = 'التركي - عميل', customNameEn = 'التركي - عميل', nameEn = 'التركي - عميل', parent = '58', accountNature = '0', theValue = '129905', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '529';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1899', '398', '5', '','0'); -- id=1933
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '398038', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1899', '143', '25105', '','0'); -- id=1900
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3839145', 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 ( '22118.1', '22118.1', '2026-10-09', '1', '0', '0', '2026-10-09 20:30:18','اضافة فاتورة مبيعات رقم 369 - صرف البضاعة من المخزن','1','0',null,'0','369','sellbillController.php?do=showDetail&sellbillid=369'); -- id=1900
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1900', '402', '22118.1', '','0'); -- id=1934
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3607041.33', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1900', '382', '22118.1', '','0'); -- id=1901
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20349027.87', 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='1899,0,1900' where sellbillid=369;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 25100, 22776, 22776
                    , 22776, 22118.1, 22118.1, 22118.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,22776, 22776, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+25100, sellCostBuyPrice =sellCostBuyPrice+22776
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22776, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22776
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22118.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22118.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22118.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22776
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22776
                        , returnSellVal = returnSellVal+0, 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 (31, '2026-10-09', 25100, 22776, 22776
                    , 22776, 22118.1, 22118.1, 22118.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,22776, 22776, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+25100, sellCostBuyPrice =sellCostBuyPrice+22776
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22776, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22776
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22118.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22118.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22118.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22776
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22776
                        , returnSellVal = returnSellVal+0, 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, 25100, 22776, 22776
                    , 22776, 22118.1, 22118.1, 22118.1, 22776, 22776)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+25100, netSellCostBuyPrice = netSellCostBuyPrice+22776
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+22776
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+22776
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+22118.1
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+22118.1
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+22118.1
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+22776
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+22776;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 269 and newid=369 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:00:18";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:30:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:30:18', '1', 'editprint', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editprint&id=369'); -- id=6545
UPDATE user SET loginip = "" WHERE userid = 2;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:03:03";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:33:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:33:03', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6546
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:03:18";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:33:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:33:18', '1', 'editsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=369'); -- id=6547
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:03:30";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:33:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:33:30', '1', 'update', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=update'); -- id=6548
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 369;
UPDATE sellbill SET  sellbillsysdate = '2026-10-09 20:33:30', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '369';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 505;
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 362.70, meanbuyprice_withDiscount = 362.70
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 362.7
                where sellbilldetailid = 1296;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1659, '2026-10-09', 1169.7669786895, 1170, 1170
                    , 1170, 1088.1, 1088.1, 1088.1
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1169.7669786895, sellCostBuyPrice =sellCostBuyPrice-1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1088.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1088.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1088.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1170
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1169.7669786895, 1170, 1170
                    , 1170, 1088.1, 1088.1, 1088.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1169.7669786895, sellCostBuyPrice =sellCostBuyPrice-1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1088.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1088.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1088.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1170
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '168', userid = '1', storedetaildate = '2026-10-09 20:33:30' WHERE storedetailid = '2671';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1659', '1', '3', '0', '369', 'تعديل فاتورة مبيعات', 'sellbillController.php', '165', '168', '1', '2026-10-09 09:59:13','0','0'); -- id=4301
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-9 where id = 71;
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1297;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-09', 2699.4622585142, 2430, 2430
                    , 2430, 2430, 2430, 2430
                    , 0, 0, 0, 0
                    , 0, 0, 0,9,0, 2430, 2430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2699.4622585142, sellCostBuyPrice =sellCostBuyPrice-2430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2430, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2430
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-9
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2699.4622585142, 2430, 2430
                    , 2430, 2430, 2430, 2430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2430, 2430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2699.4622585142, sellCostBuyPrice =sellCostBuyPrice-2430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2430, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2430
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '624', userid = '1', storedetaildate = '2026-10-09 20:33:30' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '9', '0', '369', 'تعديل فاتورة مبيعات', 'sellbillController.php', '615', '624', '1', '2026-10-09 09:59:13','0','0'); -- id=4302
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 71;
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1298;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-09', 899.82075283808, 810, 810
                    , 810, 810, 810, 810
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 810, 810, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-899.82075283808, sellCostBuyPrice =sellCostBuyPrice-810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-810, sellCostMeanBuyPrice = sellCostMeanBuyPrice-810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-810
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-810
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-810
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 899.82075283808, 810, 810
                    , 810, 810, 810, 810
                    , 0, 0, 0, 0
                    , 0, 0, 0, 810, 810, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-899.82075283808, sellCostBuyPrice =sellCostBuyPrice-810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-810, sellCostMeanBuyPrice = sellCostMeanBuyPrice-810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-810
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-810
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-810
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '627', userid = '1', storedetaildate = '2026-10-09 20:33:30' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '3', '0', '369', 'تعديل فاتورة مبيعات', 'sellbillController.php', '624', '627', '1', '2026-10-09 09:59:13','0','0'); -- id=4303
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-18 where id = 282;
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 288.00, meanbuyprice_withDiscount = 288.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 288
                where sellbilldetailid = 1299;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1472, '2026-10-09', 5758.8528181637, 5760, 5760
                    , 5760, 5184, 5184, 5184
                    , 0, 0, 0, 0
                    , 0, 0, 0,18,0, 5760, 5760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5758.8528181637, sellCostBuyPrice =sellCostBuyPrice-5760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5760, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5184, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5184
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5184
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5760
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-18
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5758.8528181637, 5760, 5760
                    , 5760, 5184, 5184, 5184
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5760, 5760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5758.8528181637, sellCostBuyPrice =sellCostBuyPrice-5760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5760, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5184, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5184
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5184
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5760
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-10-09 20:33:30' WHERE storedetailid = '1497';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1472', '1', '18', '0', '369', 'تعديل فاتورة مبيعات', 'sellbillController.php', '63', '81', '1', '2026-10-09 09:59:13','0','0'); -- id=4304
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 74;
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1300;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1382, '2026-10-09', 2399.5220075682, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2399.5220075682, sellCostBuyPrice =sellCostBuyPrice-2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2160
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2399.5220075682, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2399.5220075682, sellCostBuyPrice =sellCostBuyPrice-2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2160
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '57', userid = '1', storedetaildate = '2026-10-09 20:33:30' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '6', '0', '369', 'تعديل فاتورة مبيعات', 'sellbillController.php', '51', '57', '1', '2026-10-09 09:59:13','0','0'); -- id=4305
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 72;
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1301;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-09', 2339.533957379, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2339.533957379, sellCostBuyPrice =sellCostBuyPrice-2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2100
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2339.533957379, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2339.533957379, sellCostBuyPrice =sellCostBuyPrice-2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2100
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '576', userid = '1', storedetaildate = '2026-10-09 20:33:30' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '6', '0', '369', 'تعديل فاتورة مبيعات', 'sellbillController.php', '570', '576', '1', '2026-10-09 09:59:13','0','0'); -- id=4306
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-9 where id = 72;
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1302;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-09', 3509.3009360685, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0,9,0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3509.3009360685, sellCostBuyPrice =sellCostBuyPrice-3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3150
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-9
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3509.3009360685, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3509.3009360685, sellCostBuyPrice =sellCostBuyPrice-3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3150
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '585', userid = '1', storedetaildate = '2026-10-09 20:33:30' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '9', '0', '369', 'تعديل فاتورة مبيعات', 'sellbillController.php', '576', '585', '1', '2026-10-09 09:59:13','0','0'); -- id=4307
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 73;
UPDATE sellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.00
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260, lastbuyprice_withDiscountAndTax = 260
                where sellbilldetailid = 1303;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1381, '2026-10-09', 884.82374029078, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-884.82374029078, sellCostBuyPrice =sellCostBuyPrice-780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-780, sellCostMeanBuyPrice = sellCostMeanBuyPrice-780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-780
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 884.82374029078, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-884.82374029078, 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 = '297', userid = '1', storedetaildate = '2026-10-09 20:33:30' WHERE storedetailid = '1381';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1381', '1', '3', '0', '369', 'تعديل فاتورة مبيعات', 'sellbillController.php', '294', '297', '1', '2026-10-09 09:59:13','0','0'); -- id=4308
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-16 where id = 355;
UPDATE sellbilldetail SET  lastbuyprice = 276.00 , meanbuyprice = 276.00, lastbuyprice_withDiscount = 276.00, meanbuyprice_withDiscount = 276.00
        , lastbuyprice_withTax = 276, meanbuyprice_withTax = 276, lastbuyprice_withDiscountAndTax = 276
                where sellbilldetailid = 1304;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1467, '2026-10-09', 5438.916550488, 4416, 4416
                    , 4416, 4416, 4416, 4416
                    , 0, 0, 0, 0
                    , 0, 0, 0,16,0, 4416, 4416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5438.916550488, sellCostBuyPrice =sellCostBuyPrice-4416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4416, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4416
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-16
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5438.916550488, 4416, 4416
                    , 4416, 4416, 4416, 4416
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4416, 4416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5438.916550488, sellCostBuyPrice =sellCostBuyPrice-4416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4416, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4416
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '680', userid = '1', storedetaildate = '2026-10-09 20:33:30' WHERE storedetailid = '1492';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1467', '1', '16', '0', '369', 'تعديل فاتورة مبيعات', 'sellbillController.php', '664', '680', '1', '2026-10-09 09:59:13','0','0'); -- id=4309
CALL clientInUse(31,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '777550', userid = '1' WHERE clientid = '31';
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 ('31','802650.00','25100.00','1','تعديل فاتورة مبيعات','369', '777550', '2026-10-09 09:59:13', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '25100', '0', null, '0', null, null,'', '0','1','1','25100','1','2026-10-09 09:59:13','0','0','',''); -- id=486
UPDATE client SET  inUse = 0 where clientid = 31;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 25100, 22776, 22776
                    , 22776, 22118.1, 22118.1, 22118.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,22776, 22776, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-25100, sellCostBuyPrice =sellCostBuyPrice-22776
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-22776, sellCostMeanBuyPrice = sellCostMeanBuyPrice-22776
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-22118.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-22118.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-22118.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-22776
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-22776
                        , returnSellVal = returnSellVal-0, 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 (31, '2026-10-09', 25100, 22776, 22776
                    , 22776, 22118.1, 22118.1, 22118.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22776, 22776, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-25100, sellCostBuyPrice =sellCostBuyPrice-22776
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-22776, sellCostMeanBuyPrice = sellCostMeanBuyPrice-22776
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-22118.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-22118.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-22118.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-22776
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-22776
                        , returnSellVal = returnSellVal-0, 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, 25100, 22776, 22776
                    , 22776, 22118.1, 22118.1, 22118.1, 22776, 22776)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-25100, netSellCostBuyPrice = netSellCostBuyPrice-22776
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-22776
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-22776
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-22118.1
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-22118.1
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-22118.1
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-22776
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-22776;

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


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

COMMIT;
BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:59:13', '06ac88db765507', '1', '0.00', '0', '5', '1', '25105', '25100', '25100', '0', '1', '2026-10-09 09:59:13', '', '1', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '73', '369', 'sellbillController', '0','','','','','-1','0','0','25100','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-09','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=370
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','اضافة فاتورة مبيعات (معدله)','370', '0', '2026-10-09 20:33:30', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '25100', '0', null, '0', null, null,'', '0','1','1','25100','1','2026-10-09 09:59:13','0','0','',''); -- id=487
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 505;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('362.7','01659', '370', '125', '1659', '3.00', '390', '1170', '0', '', '0', '2026-10-09 20:33:30', '1659', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','505-3,','1','1','0','0','390','1170','0','','0','0.00','0','0','0','0'); -- id=1305
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 362.70, meanbuyprice_withDiscount = 362.70
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 362.7
                where sellbilldetailid = 1305;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1659, '2026-10-09', 1169.7669786895, 1170, 1170
                    , 1170, 1088.1, 1088.1, 1088.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1169.7669786895, sellCostBuyPrice =sellCostBuyPrice+1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1088.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1088.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1088.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1170
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1169.7669786895, 1170, 1170
                    , 1170, 1088.1, 1088.1, 1088.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1169.7669786895, sellCostBuyPrice =sellCostBuyPrice+1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1088.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1088.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1088.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1170
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '165', userid = '1', storedetaildate = '2026-10-09 20:33:30' WHERE storedetailid = '2671';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1659', '1', '3', '1', '370', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '168', '165', '1', '2026-10-09 20:33:30','0','0'); -- id=4310
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','01379', '370', '94', '1379', '9.00', '300', '2700', '0', '', '0', '2026-10-09 20:33:30', '1379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','71-9,','1','1','0','0','300','2700','0','','0','0.00','0','0','0','0'); -- id=1306
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1306;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-09', 2699.4622585142, 2430, 2430
                    , 2430, 2430, 2430, 2430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2430, 2430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2699.4622585142, sellCostBuyPrice =sellCostBuyPrice+2430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2699.4622585142, 2430, 2430
                    , 2430, 2430, 2430, 2430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2430, 2430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2699.4622585142, sellCostBuyPrice =sellCostBuyPrice+2430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '618', userid = '1', storedetaildate = '2026-10-09 20:33:30' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '9', '1', '370', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '627', '618', '1', '2026-10-09 20:33:30','0','0'); -- id=4311
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','01379', '370', '94', '1379', '3.00', '300', '900', '0', '', '0', '2026-10-09 20:33:30', '1379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','71-3,','1','1','0','0','300','900','0','','0','0.00','0','0','0','0'); -- id=1307
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1307;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-09', 899.82075283808, 810, 810
                    , 810, 810, 810, 810
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 810, 810, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+899.82075283808, sellCostBuyPrice =sellCostBuyPrice+810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+810, sellCostMeanBuyPrice = sellCostMeanBuyPrice+810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+810
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+810
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+810
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 899.82075283808, 810, 810
                    , 810, 810, 810, 810
                    , 0, 0, 0, 0
                    , 0, 0, 0, 810, 810, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+899.82075283808, sellCostBuyPrice =sellCostBuyPrice+810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+810, sellCostMeanBuyPrice = sellCostMeanBuyPrice+810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+810
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+810
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+810
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '615', userid = '1', storedetaildate = '2026-10-09 20:33:30' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '3', '1', '370', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '618', '615', '1', '2026-10-09 20:33:30','0','0'); -- id=4312
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+18 where id = 282;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('288','01472', '370', '105', '1472', '18.00', '320', '5760', '0', '', '0', '2026-10-09 20:33:30', '1472', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','282-18,','1','1','0','0','320','5760','0','','0','0.00','0','0','0','0'); -- id=1308
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 288.00, meanbuyprice_withDiscount = 288.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 288
                where sellbilldetailid = 1308;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1472, '2026-10-09', 5758.8528181637, 5760, 5760
                    , 5760, 5184, 5184, 5184
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 0, 5760, 5760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5758.8528181637, sellCostBuyPrice =sellCostBuyPrice+5760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5184, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5184
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5184
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+18
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5758.8528181637, 5760, 5760
                    , 5760, 5184, 5184, 5184
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5760, 5760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5758.8528181637, sellCostBuyPrice =sellCostBuyPrice+5760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5184, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5184
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5184
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '63', userid = '1', storedetaildate = '2026-10-09 20:33:30' WHERE storedetailid = '1497';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1472', '1', '18', '1', '370', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '81', '63', '1', '2026-10-09 20:33:30','0','0'); -- id=4313
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 74;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','01382', '370', '94', '1382', '6.00', '400', '2400', '0', '', '0', '2026-10-09 20:33:30', '1382', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','74-6,','1','1','0','0','400','2400','0','','0','0.00','0','0','0','0'); -- id=1309
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1309;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1382, '2026-10-09', 2399.5220075682, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2399.5220075682, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2399.5220075682, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2399.5220075682, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '51', userid = '1', storedetaildate = '2026-10-09 20:33:30' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '6', '1', '370', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '57', '51', '1', '2026-10-09 20:33:30','0','0'); -- id=4314
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 72;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01380', '370', '94', '1380', '6.00', '390', '2340', '0', '', '0', '2026-10-09 20:33:30', '1380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','72-6,','1','1','0','0','390','2340','0','','0','0.00','0','0','0','0'); -- id=1310
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1310;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-09', 2339.533957379, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2339.533957379, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2339.533957379, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2339.533957379, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '579', userid = '1', storedetaildate = '2026-10-09 20:33:30' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '6', '1', '370', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '585', '579', '1', '2026-10-09 20:33:30','0','0'); -- id=4315
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 72;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01380', '370', '94', '1380', '9.00', '390', '3510', '0', '', '0', '2026-10-09 20:33:30', '1380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','72-9,','1','1','0','0','390','3510','0','','0','0.00','0','0','0','0'); -- id=1311
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1311;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-09', 3509.3009360685, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3509.3009360685, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3509.3009360685, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3509.3009360685, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '570', userid = '1', storedetaildate = '2026-10-09 20:33:30' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '9', '1', '370', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '579', '570', '1', '2026-10-09 20:33:30','0','0'); -- id=4316
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 73;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('260','01381', '370', '94', '1381', '3.00', '295', '885', '0', '', '0', '2026-10-09 20:33:30', '1381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','73-3,','1','1','0','0','295','885','0','','0','0.00','0','0','0','0'); -- id=1312
UPDATE sellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.00
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260, lastbuyprice_withDiscountAndTax = 260
                where sellbilldetailid = 1312;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1381, '2026-10-09', 884.82374029078, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+884.82374029078, sellCostBuyPrice =sellCostBuyPrice+780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 884.82374029078, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+884.82374029078, 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 = '294', userid = '1', storedetaildate = '2026-10-09 20:33:30' WHERE storedetailid = '1381';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1381', '1', '3', '1', '370', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '297', '294', '1', '2026-10-09 20:33:30','0','0'); -- id=4317
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+16 where id = 355;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('276','01467', '370', '104', '1467', '16.00', '340', '5440', '0', '', '0', '2026-10-09 20:33:30', '1467', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','355-16,','1','1','0','0','340','5440','0','','0','0.00','0','0','0','0'); -- id=1313
UPDATE sellbilldetail SET  lastbuyprice = 276.00 , meanbuyprice = 276.00, lastbuyprice_withDiscount = 276.00, meanbuyprice_withDiscount = 276.00
        , lastbuyprice_withTax = 276, meanbuyprice_withTax = 276, lastbuyprice_withDiscountAndTax = 276
                where sellbilldetailid = 1313;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1467, '2026-10-09', 5438.916550488, 4416, 4416
                    , 4416, 4416, 4416, 4416
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 4416, 4416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5438.916550488, sellCostBuyPrice =sellCostBuyPrice+4416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4416, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4416
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5438.916550488, 4416, 4416
                    , 4416, 4416, 4416, 4416
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4416, 4416, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5438.916550488, sellCostBuyPrice =sellCostBuyPrice+4416
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4416, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4416
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4416, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4416
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4416
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4416
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4416
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '664', userid = '1', storedetaildate = '2026-10-09 20:33:30' WHERE storedetailid = '1492';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1467', '1', '16', '1', '370', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '680', '664', '1', '2026-10-09 20:33:30','0','0'); -- id=4318
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2235128',  userid = '1' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('2210028','25100', '0', '2', 'اضافة فاتورة مبيعات (معدله)', '370', '2235128', '2026-10-09 20:33:30', '1',  'sellbillController.php','1','','0'); -- id=426
UPDATE dailyentry SET totalcreditor = '25105.00', totaldebtor = '25105.00', thedate = '2026-10-09', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 20:30:18', entryComment = 'اضافة فاتورة مبيعات رقم 369', fromFlag = '1',related='0',isopeningentry='0',operationId='369',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=369' WHERE id = '1899';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '25105.00', '25105.00', '2026-10-09', '1', '0', '1899', '2026-10-09 20:33:30','تم عكس القيد رقم 1899 ','1','0','-1','0','0',''); -- id=1901
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1901', '529', '25100.00', '','0'); -- id=1902
UPDATE accountstree SET name = 'التركي - عميل', customName = 'التركي - عميل', customNameEn = 'التركي - عميل', nameEn = 'التركي - عميل', parent = '58', accountNature = '0', theValue = '104805', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '529';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1901', '398', '5.00', '','0'); -- id=1903
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '398033', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1901', '143', '25105.00', '','0'); -- id=1935
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3814040', 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 = '22118.10', totaldebtor = '22118.10', thedate = '2026-10-09', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 20:30:18', entryComment = 'اضافة فاتورة مبيعات رقم 369 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='369',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=369' WHERE id = '1900';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '22118.10', '22118.10', '2026-10-09', '1', '0', '1900', '2026-10-09 20:33:30','تم عكس القيد رقم 1900 ','1','0','-1','0','0',''); -- id=1902
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1902', '402', '22118.10', '','0'); -- id=1904
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3584923.23', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1902', '382', '22118.10', '','0'); -- id=1936
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20371145.97', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '25105', '25105', '2026-10-09', '1', '0', '0', '2026-10-09 20:33:30','اضافة فاتورة مبيعات رقم 370','1','0',null,'0','370','sellbillController.php?do=showDetail&sellbillid=370'); -- id=1903
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1903', '419', '25100', '','0'); -- id=1937
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '2235125', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1903', '398', '5', '','0'); -- id=1938
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '398038', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1903', '143', '25105', '','0'); -- id=1905
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3839145', 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 ( '22118.1', '22118.1', '2026-10-09', '1', '0', '0', '2026-10-09 20:33:30','اضافة فاتورة مبيعات رقم 370 - صرف البضاعة من المخزن','1','0',null,'0','370','sellbillController.php?do=showDetail&sellbillid=370'); -- id=1904
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1904', '402', '22118.1', '','0'); -- id=1939
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3607041.33', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1904', '382', '22118.1', '','0'); -- id=1906
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20349027.87', 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='1903,0,1904' where sellbillid=370;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 25100, 22776, 22776
                    , 22776, 22118.1, 22118.1, 22118.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,22776, 22776, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+25100, sellCostBuyPrice =sellCostBuyPrice+22776
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22776, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22776
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22118.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22118.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22118.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22776
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22776
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 25100, 22776, 22776
                    , 22776, 22118.1, 22118.1, 22118.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,22776, 22776, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+25100, sellCostBuyPrice =sellCostBuyPrice+22776
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22776, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22776
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22118.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22118.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22118.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22776
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22776
                        , returnSellVal = returnSellVal+0, 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, 25100, 22776, 22776
                    , 22776, 22118.1, 22118.1, 22118.1, 22776, 22776)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+25100, netSellCostBuyPrice = netSellCostBuyPrice+22776
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+22776
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+22776
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+22118.1
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+22118.1
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+22118.1
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+22776
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+22776;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 369 and newid=370 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:03:30";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:33:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:33:30', '1', 'editprint', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editprint&id=370'); -- id=6549
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:03:42";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:33:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:33:42', '1', 'editsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=369'); -- id=6550
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:03:44";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:33:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:33:44', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6551
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:03:48";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:33:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:33:48', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6552
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:04:06";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:34:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:34:06', '1', 'editsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=266'); -- id=6553
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:04:27";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:34:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:34:27', '1', 'update', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=update'); -- id=6554
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 266;
UPDATE sellbill SET  sellbillsysdate = '2026-10-09 20:34:27', userid = '4',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '266';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-24 where id = 621;
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 495.00, meanbuyprice_withDiscount = 495.00
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 495
                where sellbilldetailid = 996;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1722, '2026-10-09', 13200, 13200, 13200
                    , 13200, 11880, 11880, 11880
                    , 0, 0, 0, 0
                    , 0, 0, 0,24,0, 13200, 13200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-13200, sellCostBuyPrice =sellCostBuyPrice-13200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-13200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-13200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-11880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-11880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-11880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-13200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-13200
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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 (2, '2026-10-09', 13200, 13200, 13200
                    , 13200, 11880, 11880, 11880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13200, 13200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-13200, sellCostBuyPrice =sellCostBuyPrice-13200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-13200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-13200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-11880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-11880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-11880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-13200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-13200
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-10-09 20:34:27' WHERE storedetailid = '2735';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1722', '2', '24', '0', '266', 'تعديل فاتورة مبيعات', 'sellbillController.php', '36', '60', '1', '2026-10-09 09:51:47','0','0'); -- id=4319
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 222;
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 997;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1441, '2026-10-09', 1640, 1520, 1520
                    , 1520, 1520, 1520, 1520
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 1520, 1520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1640, sellCostBuyPrice =sellCostBuyPrice-1520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1520, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1520
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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 (2, '2026-10-09', 1640, 1520, 1520
                    , 1520, 1520, 1520, 1520
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1520, 1520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1640, sellCostBuyPrice =sellCostBuyPrice-1520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1520, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1520
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-10-09 20:34:27' WHERE storedetailid = '1472';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1441', '2', '4', '0', '266', 'تعديل فاتورة مبيعات', 'sellbillController.php', '16', '20', '1', '2026-10-09 09:51:47','0','0'); -- id=4320
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-12 where id = 131;
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 355.63, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 355.63
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 355.63, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 998;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1324, '2026-10-09', 4680, 4320, 4320
                    , 4267.56, 4320, 4267.56, 4262.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,12,0, 4320, 4267.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4680, sellCostBuyPrice =sellCostBuyPrice-4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4267.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4267.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4262.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4267.56
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-12
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-09', 4680, 4320, 4320
                    , 4267.56, 4320, 4267.56, 4262.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4320, 4267.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4680, sellCostBuyPrice =sellCostBuyPrice-4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4267.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4267.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4262.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4267.56
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '685', userid = '1', storedetaildate = '2026-10-09 20:34:27' WHERE storedetailid = '1405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '2', '12', '0', '266', 'تعديل فاتورة مبيعات', 'sellbillController.php', '673', '685', '1', '2026-10-09 09:51:47','0','0'); -- id=4321
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-8 where id = 226;
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 390.00
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 390
                where sellbilldetailid = 999;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1445, '2026-10-09', 3360, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3360, sellCostBuyPrice =sellCostBuyPrice-3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3120
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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 (2, '2026-10-09', 3360, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3360, sellCostBuyPrice =sellCostBuyPrice-3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3120
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2026-10-09 20:34:27' WHERE storedetailid = '1476';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1445', '2', '8', '0', '266', 'تعديل فاتورة مبيعات', 'sellbillController.php', '8', '16', '1', '2026-10-09 09:51:47','0','0'); -- id=4322
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 133;
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1000;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1325, '2026-10-09', 1170, 1050, 1050
                    , 1050, 1050, 1050, 1050
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 1050, 1050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1170, sellCostBuyPrice =sellCostBuyPrice-1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1050
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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 (2, '2026-10-09', 1170, 1050, 1050
                    , 1050, 1050, 1050, 1050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1050, 1050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1170, sellCostBuyPrice =sellCostBuyPrice-1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1050
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '229', userid = '1', storedetaildate = '2026-10-09 20:34:27' WHERE storedetailid = '1406';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1325', '2', '3', '0', '266', 'تعديل فاتورة مبيعات', 'sellbillController.php', '226', '229', '1', '2026-10-09 09:51:47','0','0'); -- id=4323
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-8 where id = 221;
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 390.00
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 390
                where sellbilldetailid = 1001;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1440, '2026-10-09', 3360, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3360, sellCostBuyPrice =sellCostBuyPrice-3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3120
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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 (2, '2026-10-09', 3360, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3360, sellCostBuyPrice =sellCostBuyPrice-3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3120
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '52', userid = '1', storedetaildate = '2026-10-09 20:34:27' WHERE storedetailid = '1471';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1440', '2', '8', '0', '266', 'تعديل فاتورة مبيعات', 'sellbillController.php', '44', '52', '1', '2026-10-09 09:51:47','0','0'); -- id=4324
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 225;
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 390.00
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 390
                where sellbilldetailid = 1002;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1444, '2026-10-09', 1680, 1560, 1560
                    , 1560, 1560, 1560, 1560
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 1560, 1560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1680, sellCostBuyPrice =sellCostBuyPrice-1560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1560, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1560
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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 (2, '2026-10-09', 1680, 1560, 1560
                    , 1560, 1560, 1560, 1560
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1560, 1560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1680, sellCostBuyPrice =sellCostBuyPrice-1560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1560, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1560
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-10-09 20:34:27' WHERE storedetailid = '1475';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1444', '2', '4', '0', '266', 'تعديل فاتورة مبيعات', 'sellbillController.php', '4', '8', '1', '2026-10-09 09:51:47','0','0'); -- id=4325
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0.00','1','تعديل فاتورة مبيعات','266', '0', '2026-10-09 09:51:47', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '29090', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:51:47','0','0','',''); -- id=488
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '456420',  userid = '1' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('485510','29090', '1', '3', 'تعديل فاتورة مبيعات', '266', '456420', '2026-10-09 20:34:27', '1',  'sellbillController.php','1','','0'); -- id=427
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 29090, 27890, 27890
                    , 27837.56, 26570, 26517.56, 26512.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,27890, 27837.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-29090, sellCostBuyPrice =sellCostBuyPrice-27890
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-27890, sellCostMeanBuyPrice = sellCostMeanBuyPrice-27837.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-26570, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-26517.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-26512.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-27890
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-27837.56
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 29090, 27890, 27890
                    , 27837.56, 26570, 26517.56, 26512.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 27890, 27837.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-29090, sellCostBuyPrice =sellCostBuyPrice-27890
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-27890, sellCostMeanBuyPrice = sellCostMeanBuyPrice-27837.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-26570, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-26517.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-26512.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-27890
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-27837.56
                        , returnSellVal = returnSellVal-0, 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, 29090, 27890, 27890
                    , 27837.56, 26570, 26517.56, 26512.4, 27890, 27837.56)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-29090, netSellCostBuyPrice = netSellCostBuyPrice-27890
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-27890
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-27837.56
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-26570
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-26517.56
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-26512.4
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-27890
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-27837.56;

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


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

COMMIT;
BEGIN;
CALL clientInUse(31,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:51:47', '06ac88ae49ef32', '31', '777550.00', '806640', '0', '1', '29090', '29090', '0', '29090', '2', '2026-10-09 09:51:47', '', '1', '0', 'التركي - عميل', '3', '1', '3', '0', 'التركي - عميل', '63', '266', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-09','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=371
UPDATE client SET  clientdebt = '806640', userid = '1' WHERE clientid = '31';
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 ('31','777550.00','29090','0','اضافة فاتورة مبيعات (معدله)','371', '806640', '2026-10-09 20:34:27', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '29090', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:51:47','0','0','',''); -- id=489
UPDATE client SET  inUse = 0 where clientid = 31;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+24 where id = 621;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('495','01722', '371', '49', '1722', '24.00', '550', '13200', '0', '', '0', '2026-10-09 20:34:27', '1722', '0.00', '0', '2','0.00','','','0','0','0','0','0','0','0','0','','621-24,','1','1','0','0','550','13200','0','','0','0.00','0','0','0','0'); -- id=1314
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 495.00, meanbuyprice_withDiscount = 495.00
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 495
                where sellbilldetailid = 1314;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1722, '2026-10-09', 13200, 13200, 13200
                    , 13200, 11880, 11880, 11880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24, 0, 13200, 13200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13200, sellCostBuyPrice =sellCostBuyPrice+13200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 13200, 13200, 13200
                    , 13200, 11880, 11880, 11880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13200, 13200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13200, sellCostBuyPrice =sellCostBuyPrice+13200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-10-09 20:34:27' WHERE storedetailid = '2735';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1722', '2', '24', '1', '371', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '60', '36', '1', '2026-10-09 20:34:27','0','0'); -- id=4326
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 222;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('380','01441', '371', '88', '1441', '4.00', '410', '1640', '0', '', '0', '2026-10-09 20:34:27', '1441', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','222-4,','1','1','0','0','410','1640','0','','0','0.00','0','0','0','0'); -- id=1315
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 1315;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1441, '2026-10-09', 1640, 1520, 1520
                    , 1520, 1520, 1520, 1520
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1520, 1520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1640, sellCostBuyPrice =sellCostBuyPrice+1520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1640, 1520, 1520
                    , 1520, 1520, 1520, 1520
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1520, 1520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1640, sellCostBuyPrice =sellCostBuyPrice+1520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2026-10-09 20:34:27' WHERE storedetailid = '1472';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1441', '2', '4', '1', '371', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '16', '1', '2026-10-09 20:34:27','0','0'); -- id=4327
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01324', '371', '86', '1324', '12.00', '390', '4680', '0', '', '0', '2026-10-09 20:34:27', '1324', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','131-12,','1','1','0','0','390','4680','0','','0','0.00','0','0','0','0'); -- id=1316
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 355.63, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 355.63
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 355.63, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1316;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1324, '2026-10-09', 4680, 4320, 4320
                    , 4267.56, 4320, 4267.56, 4262.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4320, 4267.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4680, sellCostBuyPrice =sellCostBuyPrice+4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4267.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4267.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4262.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4267.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-09', 4680, 4320, 4320
                    , 4267.56, 4320, 4267.56, 4262.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4320, 4267.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4680, sellCostBuyPrice =sellCostBuyPrice+4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4267.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4267.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4262.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4267.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '673', userid = '1', storedetaildate = '2026-10-09 20:34:27' WHERE storedetailid = '1405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '2', '12', '1', '371', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '685', '673', '1', '2026-10-09 20:34:27','0','0'); -- id=4328
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where 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 ('390','01445', '371', '88', '1445', '8.00', '420', '3360', '0', '', '0', '2026-10-09 20:34:27', '1445', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','226-8,','1','1','0','0','420','3360','0','','0','0.00','0','0','0','0'); -- id=1317
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 390.00
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 390
                where sellbilldetailid = 1317;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1445, '2026-10-09', 3360, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 3360, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-10-09 20:34:27' WHERE storedetailid = '1476';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1445', '2', '8', '1', '371', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '16', '8', '1', '2026-10-09 20:34:27','0','0'); -- id=4329
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 133;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01325', '371', '87', '1325', '3.00', '390', '1170', '0', '', '0', '2026-10-09 20:34:27', '1325', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','133-3,','1','1','0','0','390','1170','0','','0','0.00','0','0','0','0'); -- id=1318
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 1318;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1325, '2026-10-09', 1170, 1050, 1050
                    , 1050, 1050, 1050, 1050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1050, 1050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1170, 1050, 1050
                    , 1050, 1050, 1050, 1050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1050, 1050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '226', userid = '1', storedetaildate = '2026-10-09 20:34:27' WHERE storedetailid = '1406';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1325', '2', '3', '1', '371', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '229', '226', '1', '2026-10-09 20:34:27','0','0'); -- id=4330
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 221;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('390','01440', '371', '88', '1440', '8.00', '420', '3360', '0', '', '0', '2026-10-09 20:34:27', '1440', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','221-8,','1','1','0','0','420','3360','0','','0','0.00','0','0','0','0'); -- id=1319
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 390.00
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 390
                where sellbilldetailid = 1319;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1440, '2026-10-09', 3360, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 3360, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '44', userid = '1', storedetaildate = '2026-10-09 20:34:27' WHERE storedetailid = '1471';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1440', '2', '8', '1', '371', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '52', '44', '1', '2026-10-09 20:34:27','0','0'); -- id=4331
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 225;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('390','01444', '371', '88', '1444', '4.00', '420', '1680', '0', '', '0', '2026-10-09 20:34:27', '1444', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','225-4,','1','1','0','0','420','1680','0','','0','0.00','0','0','0','0'); -- id=1320
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 390.00
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 390
                where sellbilldetailid = 1320;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1444, '2026-10-09', 1680, 1560, 1560
                    , 1560, 1560, 1560, 1560
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1560, 1560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1680, sellCostBuyPrice =sellCostBuyPrice+1560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1560
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (2, '2026-10-09', 1680, 1560, 1560
                    , 1560, 1560, 1560, 1560
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1560, 1560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1680, sellCostBuyPrice =sellCostBuyPrice+1560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1560
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2026-10-09 20:34:27' WHERE storedetailid = '1475';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1444', '2', '4', '1', '371', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '8', '4', '1', '2026-10-09 20:34:27','0','0'); -- id=4332
UPDATE dailyentry SET totalcreditor = '29090.00', totaldebtor = '29090.00', thedate = '2026-10-09', userid = '4', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 09:51:47', entryComment = 'اضافة فاتورة مبيعات رقم 266', fromFlag = '1',related='0',isopeningentry='0',operationId='266',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=266' WHERE id = '1653';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '29090.00', '29090.00', '2026-10-09', '1', '0', '1653', '2026-10-09 20:34:27','تم عكس القيد رقم 1653 ','1','0','-1','0','0',''); -- id=1905
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1905', '501', '29090.00', '','0'); -- id=1907
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '456420', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1905', '143', '29090.00', '','0'); -- id=1940
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3810055', 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 = '26450.00', totaldebtor = '26450.00', thedate = '2026-10-09', userid = '4', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 09:51:47', entryComment = 'اضافة فاتورة مبيعات رقم 266 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='266',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=266' WHERE id = '1654';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '26450.00', '26450.00', '2026-10-09', '1', '0', '1654', '2026-10-09 20:34:27','تم عكس القيد رقم 1654 ','1','0','-1','0','0',''); -- id=1906
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1906', '402', '26450.00', '','0'); -- id=1908
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3580591.33', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1906', '492', '26450.00', '','0'); -- id=1941
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '735670', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '29090', '29090', '2026-10-09', '1', '0', '0', '2026-10-09 20:34:27','اضافة فاتورة مبيعات رقم 371','1','0',null,'0','371','sellbillController.php?do=showDetail&sellbillid=371'); -- id=1907
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1907', '529', '29090', '','0'); -- id=1942
UPDATE accountstree SET name = 'التركي - عميل', customName = 'التركي - عميل', customNameEn = 'التركي - عميل', nameEn = 'التركي - عميل', parent = '58', accountNature = '0', theValue = '133895', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '529';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1907', '143', '29090', '','0'); -- id=1909
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3839145', 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 ( '26570', '26570', '2026-10-09', '1', '0', '0', '2026-10-09 20:34:27','اضافة فاتورة مبيعات رقم 371 - صرف البضاعة من المخزن','1','0',null,'0','371','sellbillController.php?do=showDetail&sellbillid=371'); -- id=1908
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1908', '402', '26570', '','0'); -- id=1943
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3607161.33', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1908', '492', '26570', '','0'); -- id=1910
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '709100', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='1907,0,1908' where sellbillid=371;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 29090, 27890, 27890
                    , 27837.56, 26570, 26517.56, 26512.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,27890, 27837.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+29090, sellCostBuyPrice =sellCostBuyPrice+27890
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27890, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27837.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26570, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26517.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26512.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27890
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+27837.56
                        , returnSellVal = returnSellVal+0, 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 (31, '2026-10-09', 29090, 27890, 27890
                    , 27837.56, 26570, 26517.56, 26512.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,27890, 27837.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+29090, sellCostBuyPrice =sellCostBuyPrice+27890
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27890, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27837.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26570, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26517.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26512.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27890
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+27837.56
                        , returnSellVal = returnSellVal+0, 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, 29090, 27890, 27890
                    , 27837.56, 26570, 26517.56, 26512.4, 27890, 27837.56)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+29090, netSellCostBuyPrice = netSellCostBuyPrice+27890
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+27890
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+27837.56
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+26570
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+26517.56
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+26512.4
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+27890
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+27837.56;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 266 and newid=371 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:04:27";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:34:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:34:27', '1', 'editprint', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editprint&id=371'); -- id=6555
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:06:39";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:36:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('ReturnSellBillReportsController.php', '2026-10-09 20:36:40', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/ReturnSellBillReportsController.php?do=show'); -- id=6556
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:06:47";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:36:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('ReturnSellBillReportsController.php', '2026-10-09 20:36:47', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/ReturnSellBillReportsController.php?do=show'); -- id=6557
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:07:39";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:37:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:37:39', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6558
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:07:50";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:37:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:37:50', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6559
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:08:21";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:38:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:38:21', '1', 'editsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=363'); -- id=6560
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:08:43";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:38:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:38:43', '1', 'update', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=update'); -- id=6561
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 363;
UPDATE sellbill SET  sellbillsysdate = '2026-10-09 20:38:43', userid = '2',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '363';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-25 where id = 491;
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 392.66, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 392.66
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 392.66, lastbuyprice_withDiscountAndTax = 390
                where sellbilldetailid = 1252;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (850, '2026-10-09', 9750, 9375, 9750
                    , 9816.5, 9750, 9816.5, 9750
                    , 0, 0, 0, 0
                    , 0, 0, 0,25,0, 9750, 9816.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9750, sellCostBuyPrice =sellCostBuyPrice-9375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-9750, sellCostMeanBuyPrice = sellCostMeanBuyPrice-9816.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-9750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-9816.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-9750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-9750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-9816.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-25
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 9750, 9375, 9750
                    , 9816.5, 9750, 9816.5, 9750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9750, 9816.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9750, sellCostBuyPrice =sellCostBuyPrice-9375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-9750, sellCostMeanBuyPrice = sellCostMeanBuyPrice-9816.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-9750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-9816.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-9750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-9750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-9816.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 = '150', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '850';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('850', '1', '25', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '125', '150', '1', '2026-10-09 18:43:36','0','0'); -- id=4333
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 38;
UPDATE sellbilldetail SET  lastbuyprice = 535.00 , meanbuyprice = 535.00, lastbuyprice_withDiscount = 535.00, meanbuyprice_withDiscount = 535.00
        , lastbuyprice_withTax = 535, meanbuyprice_withTax = 535, lastbuyprice_withDiscountAndTax = 535
                where sellbilldetailid = 1253;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1346, '2026-10-09', 3330, 3210, 3210
                    , 3210, 3210, 3210, 3210
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 3210, 3210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3330, sellCostBuyPrice =sellCostBuyPrice-3210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3210, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3210
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3330, 3210, 3210
                    , 3210, 3210, 3210, 3210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3210, 3210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3330, sellCostBuyPrice =sellCostBuyPrice-3210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3210, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3210
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '1346';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1346', '1', '6', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '12', '18', '1', '2026-10-09 18:43:36','0','0'); -- id=4334
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1254;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (971, '2026-10-09', 1900, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1900, sellCostBuyPrice =sellCostBuyPrice-1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1800
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1900, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1900, sellCostBuyPrice =sellCostBuyPrice-1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1800
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '971';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('971', '1', '5', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '15', '20', '1', '2026-10-09 18:43:36','0','0'); -- id=4335
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 1255;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (964, '2026-10-09', 1975, 1875, 1875
                    , 1875, 1875, 1875, 1875
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 1875, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1975, sellCostBuyPrice =sellCostBuyPrice-1875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1875, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1875
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1975, 1875, 1875
                    , 1875, 1875, 1875, 1875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1875, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1975, sellCostBuyPrice =sellCostBuyPrice-1875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1875, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1875
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-10-09 20:38:43' WHERE storedetailid = '964';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('964', '1', '5', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '60', '65', '1', '2026-10-09 18:43:36','0','0'); -- id=4336
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-5 where id = 5;
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 187.5, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 1256;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1321, '2026-10-09', 4000, 3750, 3750
                    , 3750, 3750, 3750, 3750
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 3750, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4000, sellCostBuyPrice =sellCostBuyPrice-3750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3750, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1875
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4000, 3750, 3750
                    , 3750, 3750, 3750, 3750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3750, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4000, sellCostBuyPrice =sellCostBuyPrice-3750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3750, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1875
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '1321';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1321', '1', '10', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '10', '1', '2026-10-09 18:43:36','0','0'); -- id=4337
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-10 where id = 32;
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 1257;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1327, '2026-10-09', 4800, 4600, 4600
                    , 4600, 4600, 4600, 4600
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 4600, 4600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4800, sellCostBuyPrice =sellCostBuyPrice-4600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4800, 4600, 4600
                    , 4600, 4600, 4600, 4600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4600, 4600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4800, sellCostBuyPrice =sellCostBuyPrice-4600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '1327';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1327', '1', '10', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '25', '35', '1', '2026-10-09 18:43:36','0','0'); -- id=4338
UPDATE sellbilldetail SET  lastbuyprice = 520.00 , meanbuyprice = 520.00, lastbuyprice_withDiscount = 520.00, meanbuyprice_withDiscount = 520.00
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 520
                where sellbilldetailid = 1258;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (926, '2026-10-09', 5400, 5200, 5200
                    , 5200, 5200, 5200, 5200
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 5200, 5200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5400, sellCostBuyPrice =sellCostBuyPrice-5200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5200
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5400, 5200, 5200
                    , 5200, 5200, 5200, 5200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5200, 5200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5400, sellCostBuyPrice =sellCostBuyPrice-5200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5200
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '926';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('926', '1', '10', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '10', '1', '2026-10-09 18:43:36','0','0'); -- id=4339
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-5 where id = 69;
UPDATE sellbilldetail SET  lastbuyprice = 530.00 , meanbuyprice = 530.00, lastbuyprice_withDiscount = 530.00, meanbuyprice_withDiscount = 530.00
        , lastbuyprice_withTax = 530, meanbuyprice_withTax = 530, lastbuyprice_withDiscountAndTax = 530
                where sellbilldetailid = 1259;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1354, '2026-10-09', 2750, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2750, sellCostBuyPrice =sellCostBuyPrice-2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2650
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2750, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2750, sellCostBuyPrice =sellCostBuyPrice-2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2650
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '1354';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1354', '1', '5', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '40', '45', '1', '2026-10-09 18:43:36','0','0'); -- id=4340
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 1260;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1022, '2026-10-09', 5925, 5625, 5625
                    , 5625, 5625, 5625, 5625
                    , 0, 0, 0, 0
                    , 0, 0, 0,15,0, 5625, 5625, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5925, sellCostBuyPrice =sellCostBuyPrice-5625
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5625, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5625
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5625, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5625
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5625
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5625
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5625
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-10-09', 5925, 5625, 5625
                    , 5625, 5625, 5625, 5625
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5625, 5625, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5925, sellCostBuyPrice =sellCostBuyPrice-5625
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5625, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5625
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5625, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5625
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5625
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5625
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5625
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '1022';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1022', '1', '15', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '14', '29', '1', '2026-10-09 18:43:36','0','0'); -- id=4341
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 1261;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (961, '2026-10-09', 1975, 1875, 1875
                    , 1875, 1875, 1875, 1875
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 1875, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1975, sellCostBuyPrice =sellCostBuyPrice-1875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1875, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1875
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1975, 1875, 1875
                    , 1875, 1875, 1875, 1875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1875, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1975, sellCostBuyPrice =sellCostBuyPrice-1875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1875, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1875
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '961';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('961', '1', '5', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '15', '20', '1', '2026-10-09 18:43:36','0','0'); -- id=4342
UPDATE sellbilldetail SET  lastbuyprice = 530.00 , meanbuyprice = 530.00, lastbuyprice_withDiscount = 530.00, meanbuyprice_withDiscount = 530.00
        , lastbuyprice_withTax = 530, meanbuyprice_withTax = 530, lastbuyprice_withDiscountAndTax = 530
                where sellbilldetailid = 1262;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (660, '2026-10-09', 2750, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2750, sellCostBuyPrice =sellCostBuyPrice-2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2650
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2750, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2750, sellCostBuyPrice =sellCostBuyPrice-2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2650
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '660';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('660', '1', '5', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '35', '40', '1', '2026-10-09 18:43:36','0','0'); -- id=4343
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 1263;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (764, '2026-10-09', 3950, 3750, 3750
                    , 3750, 3750, 3750, 3750
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 3750, 3750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3950, sellCostBuyPrice =sellCostBuyPrice-3750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3750, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3750
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3950, 3750, 3750
                    , 3750, 3750, 3750, 3750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3750, 3750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3950, sellCostBuyPrice =sellCostBuyPrice-3750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3750, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3750
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '70', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '764';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('764', '1', '10', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '60', '70', '1', '2026-10-09 18:43:36','0','0'); -- id=4344
UPDATE sellbilldetail SET  lastbuyprice = 570.00 , meanbuyprice = 570.00, lastbuyprice_withDiscount = 570.00, meanbuyprice_withDiscount = 570.00
        , lastbuyprice_withTax = 570, meanbuyprice_withTax = 570, lastbuyprice_withDiscountAndTax = 570
                where sellbilldetailid = 1264;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (950, '2026-10-09', 2950, 2850, 2850
                    , 2850, 2850, 2850, 2850
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2950, sellCostBuyPrice =sellCostBuyPrice-2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2850
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2950, 2850, 2850
                    , 2850, 2850, 2850, 2850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2950, sellCostBuyPrice =sellCostBuyPrice-2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2850
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '950';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('950', '1', '5', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '5', '10', '1', '2026-10-09 18:43:36','0','0'); -- id=4345
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1265;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (817, '2026-10-09', 1450, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1450, sellCostBuyPrice =sellCostBuyPrice-1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1450, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1450, sellCostBuyPrice =sellCostBuyPrice-1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '204', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '817';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('817', '1', '5', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '199', '204', '1', '2026-10-09 18:43:36','0','0'); -- id=4346
UPDATE sellbilldetail SET  lastbuyprice = 395.00 , meanbuyprice = 395.00, lastbuyprice_withDiscount = 395.00, meanbuyprice_withDiscount = 395.00
        , lastbuyprice_withTax = 395, meanbuyprice_withTax = 395, lastbuyprice_withDiscountAndTax = 395
                where sellbilldetailid = 1266;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1002, '2026-10-09', 2075, 1975, 1975
                    , 1975, 1975, 1975, 1975
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 1975, 1975, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2075, sellCostBuyPrice =sellCostBuyPrice-1975
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1975, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1975
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1975, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1975
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1975
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1975
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1975
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2075, 1975, 1975
                    , 1975, 1975, 1975, 1975
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1975, 1975, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2075, sellCostBuyPrice =sellCostBuyPrice-1975
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1975, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1975
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1975, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1975
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1975
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1975
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1975
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '55', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '1002';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1002', '1', '5', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '50', '55', '1', '2026-10-09 18:43:36','0','0'); -- id=4347
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1267;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (978, '2026-10-09', 1900, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1900, sellCostBuyPrice =sellCostBuyPrice-1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1800
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1900, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1900, sellCostBuyPrice =sellCostBuyPrice-1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1800
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '978';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('978', '1', '5', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '5', '10', '1', '2026-10-09 18:43:36','0','0'); -- id=4348
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 400.00, meanbuyprice_withDiscount = 400.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 400
                where sellbilldetailid = 1268;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1010, '2026-10-09', 10500, 10000, 10000
                    , 10000, 10000, 10000, 10000
                    , 0, 0, 0, 0
                    , 0, 0, 0,25,0, 10000, 10000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10500, sellCostBuyPrice =sellCostBuyPrice-10000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10000, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10000
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-25
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 10500, 10000, 10000
                    , 10000, 10000, 10000, 10000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10000, 10000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10500, sellCostBuyPrice =sellCostBuyPrice-10000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10000, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10000
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '1010';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1010', '1', '25', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '25', '1', '2026-10-09 18:43:36','0','0'); -- id=4349
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1269;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (886, '2026-10-09', 3800, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3800, sellCostBuyPrice =sellCostBuyPrice-3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3800, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3800, sellCostBuyPrice =sellCostBuyPrice-3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '886';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('886', '1', '10', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '10', '20', '1', '2026-10-09 18:43:36','0','0'); -- id=4350
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1270;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (817, '2026-10-09', 4350, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0,15,0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4350, sellCostBuyPrice =sellCostBuyPrice-4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4050
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-10-09', 4350, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4350, sellCostBuyPrice =sellCostBuyPrice-4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4050
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '219', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '817';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('817', '1', '15', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '204', '219', '1', '2026-10-09 18:43:36','0','0'); -- id=4351
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0.00','1','تعديل فاتورة مبيعات','363', '0', '2026-10-09 18:43:36', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '75530', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 18:43:36','0','0','',''); -- id=490
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2159598',  userid = '1' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('2235128','75530', '1', '2', 'تعديل فاتورة مبيعات', '363', '2159598', '2026-10-09 20:38:43', '1',  'sellbillController.php','1','','0'); -- id=428
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 75530, 71985, 72360
                    , 72426.5, 72360, 72426.5, 72360
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,72360, 70551.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-75530, sellCostBuyPrice =sellCostBuyPrice-71985
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-72360, sellCostMeanBuyPrice = sellCostMeanBuyPrice-72426.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-72360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-72426.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-72360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-72360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-70551.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-10-09', 75530, 71985, 72360
                    , 72426.5, 72360, 72426.5, 72360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 72360, 70551.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-75530, sellCostBuyPrice =sellCostBuyPrice-71985
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-72360, sellCostMeanBuyPrice = sellCostMeanBuyPrice-72426.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-72360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-72426.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-72360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-72360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-70551.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, 75530, 71985, 72360
                    , 72426.5, 72360, 72426.5, 72360, 72360, 70551.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-75530, netSellCostBuyPrice = netSellCostBuyPrice-71985
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-72360
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-72426.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-72360
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-72426.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-72360
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-72360
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-70551.5;

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


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

COMMIT;
BEGIN;
CALL clientInUse(31,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 18:43:36', '06ac90766def0e', '31', '806640.00', '882170', '0', '1', '75530', '75530', '0', '75530', '1', '2026-10-09 18:43:36', '', '1', '0', 'التركي - عميل', '2', '1', '3', '0', 'التركي - عميل', '181', '363', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-09','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=372
UPDATE client SET  clientdebt = '882170', userid = '1' WHERE clientid = '31';
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 ('31','806640.00','75530','0','اضافة فاتورة مبيعات (معدله)','372', '882170', '2026-10-09 20:38:43', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '75530', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 18:43:36','0','0','',''); -- id=491
UPDATE client SET  inUse = 0 where clientid = 31;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+25 where id = 491;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('390','09673', '372', '20', '850', '25.00', '390', '9750', '0', '', '0', '2026-10-09 20:38:43', '850', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','491-25,','1','1','0','0','390','9750','0','','0','0.00','0','0','0','0'); -- id=1321
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 392.66, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 392.66
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 392.66, lastbuyprice_withDiscountAndTax = 390
                where sellbilldetailid = 1321;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (850, '2026-10-09', 9750, 9375, 9750
                    , 9816.5, 9750, 9816.5, 9750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 9750, 9816.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9750, sellCostBuyPrice =sellCostBuyPrice+9375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9816.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9816.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9816.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 9750, 9375, 9750
                    , 9816.5, 9750, 9816.5, 9750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9750, 9816.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9750, sellCostBuyPrice =sellCostBuyPrice+9375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9816.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9816.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9816.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 = '125', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '850';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('850', '1', '25', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '150', '125', '1', '2026-10-09 20:38:43','0','0'); -- id=4352
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 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 ('535','01346', '372', '31', '1346', '6.00', '555', '3330', '0', '', '0', '2026-10-09 20:38:43', '1346', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','38-6,','1','1','0','0','555','3330','0','','0','0.00','0','0','0','0'); -- id=1322
UPDATE sellbilldetail SET  lastbuyprice = 535.00 , meanbuyprice = 535.00, lastbuyprice_withDiscount = 535.00, meanbuyprice_withDiscount = 535.00
        , lastbuyprice_withTax = 535, meanbuyprice_withTax = 535, lastbuyprice_withDiscountAndTax = 535
                where sellbilldetailid = 1322;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1346, '2026-10-09', 3330, 3210, 3210
                    , 3210, 3210, 3210, 3210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3210, 3210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3330, sellCostBuyPrice =sellCostBuyPrice+3210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3210
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3330, 3210, 3210
                    , 3210, 3210, 3210, 3210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3210, 3210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3330, sellCostBuyPrice =sellCostBuyPrice+3210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3210
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '1346';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1346', '1', '6', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '18', '12', '1', '2026-10-09 20:38:43','0','0'); -- id=4353
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','07264', '372', '30', '971', '5.00', '380', '1900', '0', '', '0', '2026-10-09 20:38:43', '971', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','380','1900','0','','0','0.00','0','0','0','0'); -- id=1323
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1323;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (971, '2026-10-09', 1900, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1900, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1900, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1900, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '971';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('971', '1', '5', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '15', '1', '2026-10-09 20:38:43','0','0'); -- id=4354
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('375','08663', '372', '30', '964', '5.00', '395', '1975', '0', '', '0', '2026-10-09 20:38:43', '964', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','395','1975','0','','0','0.00','0','0','0','0'); -- id=1324
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 1324;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (964, '2026-10-09', 1975, 1875, 1875
                    , 1875, 1875, 1875, 1875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1875, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1975, sellCostBuyPrice =sellCostBuyPrice+1875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1975, 1875, 1875
                    , 1875, 1875, 1875, 1875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1875, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1975, sellCostBuyPrice =sellCostBuyPrice+1875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-10-09 20:38:43' WHERE storedetailid = '964';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('964', '1', '5', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '65', '60', '1', '2026-10-09 20:38:43','0','0'); -- id=4355
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 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 ('375','01321', '372', '39', '1321', '10.00', '400', '4000', '0', '', '0', '2026-10-09 20:38:43', '1321', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','5-5,','1','1','0','0','400','4000','0','','0','0.00','0','0','0','0'); -- id=1325
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 187.5, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 1325;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1321, '2026-10-09', 4000, 3750, 3750
                    , 3750, 3750, 3750, 3750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 3750, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4000, sellCostBuyPrice =sellCostBuyPrice+3750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4000, 3750, 3750
                    , 3750, 3750, 3750, 3750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3750, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4000, sellCostBuyPrice =sellCostBuyPrice+3750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '1321';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1321', '1', '10', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '10', '0', '1', '2026-10-09 20:38:43','0','0'); -- id=4356
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 32;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','01327', '372', '37', '1327', '10.00', '480', '4800', '0', '', '0', '2026-10-09 20:38:43', '1327', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','32-10,','1','1','0','0','480','4800','0','','0','0.00','0','0','0','0'); -- id=1326
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 1326;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1327, '2026-10-09', 4800, 4600, 4600
                    , 4600, 4600, 4600, 4600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 4600, 4600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4800, sellCostBuyPrice =sellCostBuyPrice+4600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4800, 4600, 4600
                    , 4600, 4600, 4600, 4600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4600, 4600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4800, sellCostBuyPrice =sellCostBuyPrice+4600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '1327';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1327', '1', '10', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '35', '25', '1', '2026-10-09 20:38:43','0','0'); -- id=4357
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('520','08851', '372', '28', '926', '10.00', '540', '5400', '0', '', '0', '2026-10-09 20:38:43', '926', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','540','5400','0','','0','0.00','0','0','0','0'); -- id=1327
UPDATE sellbilldetail SET  lastbuyprice = 520.00 , meanbuyprice = 520.00, lastbuyprice_withDiscount = 520.00, meanbuyprice_withDiscount = 520.00
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 520
                where sellbilldetailid = 1327;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (926, '2026-10-09', 5400, 5200, 5200
                    , 5200, 5200, 5200, 5200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 5200, 5200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5400, sellCostBuyPrice =sellCostBuyPrice+5200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5400, 5200, 5200
                    , 5200, 5200, 5200, 5200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5200, 5200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5400, sellCostBuyPrice =sellCostBuyPrice+5200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '926';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('926', '1', '10', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '10', '0', '1', '2026-10-09 20:38:43','0','0'); -- id=4358
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 69;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('530','01354', '372', '26', '1354', '5.00', '550', '2750', '0', '', '0', '2026-10-09 20:38:43', '1354', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','69-5,','1','1','0','0','550','2750','0','','0','0.00','0','0','0','0'); -- id=1328
UPDATE sellbilldetail SET  lastbuyprice = 530.00 , meanbuyprice = 530.00, lastbuyprice_withDiscount = 530.00, meanbuyprice_withDiscount = 530.00
        , lastbuyprice_withTax = 530, meanbuyprice_withTax = 530, lastbuyprice_withDiscountAndTax = 530
                where sellbilldetailid = 1328;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1354, '2026-10-09', 2750, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2750, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2750, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2750, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '1354';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1354', '1', '5', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '45', '40', '1', '2026-10-09 20:38:43','0','0'); -- id=4359
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('375','08409', '372', '32', '1022', '15.00', '395', '5925', '0', '', '0', '2026-10-09 20:38:43', '1022', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','395','5925','0','','0','0.00','0','0','0','0'); -- id=1329
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 1329;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1022, '2026-10-09', 5925, 5625, 5625
                    , 5625, 5625, 5625, 5625
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 5625, 5625, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5925, sellCostBuyPrice =sellCostBuyPrice+5625
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5625, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5625
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5625, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5625
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5625
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5625
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5625
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-10-09', 5925, 5625, 5625
                    , 5625, 5625, 5625, 5625
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5625, 5625, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5925, sellCostBuyPrice =sellCostBuyPrice+5625
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5625, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5625
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5625, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5625
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5625
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5625
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5625
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '14', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '1022';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1022', '1', '15', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '29', '14', '1', '2026-10-09 20:38:43','0','0'); -- id=4360
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('375','09746', '372', '29', '961', '5.00', '395', '1975', '0', '', '0', '2026-10-09 20:38:43', '961', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','395','1975','0','','0','0.00','0','0','0','0'); -- id=1330
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 1330;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (961, '2026-10-09', 1975, 1875, 1875
                    , 1875, 1875, 1875, 1875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1875, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1975, sellCostBuyPrice =sellCostBuyPrice+1875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1975, 1875, 1875
                    , 1875, 1875, 1875, 1875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1875, 1875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1975, sellCostBuyPrice =sellCostBuyPrice+1875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '961';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('961', '1', '5', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '15', '1', '2026-10-09 20:38:43','0','0'); -- id=4361
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('530','09828', '372', '5', '660', '5.00', '550', '2750', '0', '', '0', '2026-10-09 20:38:43', '660', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','550','2750','0','','0','0.00','0','0','0','0'); -- id=1331
UPDATE sellbilldetail SET  lastbuyprice = 530.00 , meanbuyprice = 530.00, lastbuyprice_withDiscount = 530.00, meanbuyprice_withDiscount = 530.00
        , lastbuyprice_withTax = 530, meanbuyprice_withTax = 530, lastbuyprice_withDiscountAndTax = 530
                where sellbilldetailid = 1331;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (660, '2026-10-09', 2750, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2750, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2750, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2750, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '660';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('660', '1', '5', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '40', '35', '1', '2026-10-09 20:38:43','0','0'); -- id=4362
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('375','05207', '372', '10', '764', '10.00', '395', '3950', '0', '', '0', '2026-10-09 20:38:43', '764', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','395','3950','0','','0','0.00','0','0','0','0'); -- id=1332
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 1332;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (764, '2026-10-09', 3950, 3750, 3750
                    , 3750, 3750, 3750, 3750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 3750, 3750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3950, sellCostBuyPrice =sellCostBuyPrice+3750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3750
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3950, 3750, 3750
                    , 3750, 3750, 3750, 3750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3750, 3750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3950, sellCostBuyPrice =sellCostBuyPrice+3750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3750
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-10-09 20:38:43' WHERE storedetailid = '764';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('764', '1', '10', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '70', '60', '1', '2026-10-09 20:38:43','0','0'); -- id=4363
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('570','09752', '372', '28', '950', '5.00', '590', '2950', '0', '', '0', '2026-10-09 20:38:43', '950', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','590','2950','0','','0','0.00','0','0','0','0'); -- id=1333
UPDATE sellbilldetail SET  lastbuyprice = 570.00 , meanbuyprice = 570.00, lastbuyprice_withDiscount = 570.00, meanbuyprice_withDiscount = 570.00
        , lastbuyprice_withTax = 570, meanbuyprice_withTax = 570, lastbuyprice_withDiscountAndTax = 570
                where sellbilldetailid = 1333;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (950, '2026-10-09', 2950, 2850, 2850
                    , 2850, 2850, 2850, 2850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2950, sellCostBuyPrice =sellCostBuyPrice+2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2950, 2850, 2850
                    , 2850, 2850, 2850, 2850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2950, sellCostBuyPrice =sellCostBuyPrice+2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '950';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('950', '1', '5', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '10', '5', '1', '2026-10-09 20:38:43','0','0'); -- id=4364
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','00358', '372', '18', '817', '5.00', '290', '1450', '0', '', '0', '2026-10-09 20:38:43', '817', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','290','1450','0','','0','0.00','0','0','0','0'); -- id=1334
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1334;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (817, '2026-10-09', 1450, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1450, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1450, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1450, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '214', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '817';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('817', '1', '5', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '219', '214', '1', '2026-10-09 20:38:43','0','0'); -- id=4365
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('395','09227', '372', '2', '1002', '5.00', '415', '2075', '0', '', '0', '2026-10-09 20:38:43', '1002', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','415','2075','0','','0','0.00','0','0','0','0'); -- id=1335
UPDATE sellbilldetail SET  lastbuyprice = 395.00 , meanbuyprice = 395.00, lastbuyprice_withDiscount = 395.00, meanbuyprice_withDiscount = 395.00
        , lastbuyprice_withTax = 395, meanbuyprice_withTax = 395, lastbuyprice_withDiscountAndTax = 395
                where sellbilldetailid = 1335;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1002, '2026-10-09', 2075, 1975, 1975
                    , 1975, 1975, 1975, 1975
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1975, 1975, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2075, sellCostBuyPrice =sellCostBuyPrice+1975
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1975, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1975
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1975, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1975
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1975
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1975
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1975
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2075, 1975, 1975
                    , 1975, 1975, 1975, 1975
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1975, 1975, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2075, sellCostBuyPrice =sellCostBuyPrice+1975
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1975, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1975
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1975, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1975
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1975
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1975
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1975
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '50', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '1002';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1002', '1', '5', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '55', '50', '1', '2026-10-09 20:38:43','0','0'); -- id=4366
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','08633', '372', '31', '978', '5.00', '380', '1900', '0', '', '0', '2026-10-09 20:38:43', '978', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','380','1900','0','','0','0.00','0','0','0','0'); -- id=1336
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1336;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (978, '2026-10-09', 1900, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1900, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1900, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1900, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '978';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('978', '1', '5', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '10', '5', '1', '2026-10-09 20:38:43','0','0'); -- id=4367
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('400','09372', '372', '2', '1010', '25.00', '420', '10500', '0', '', '0', '2026-10-09 20:38:43', '1010', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','420','10500','0','','0','0.00','0','0','0','0'); -- id=1337
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 400.00, meanbuyprice_withDiscount = 400.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 400
                where sellbilldetailid = 1337;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1010, '2026-10-09', 10500, 10000, 10000
                    , 10000, 10000, 10000, 10000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 10000, 10000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10500, sellCostBuyPrice =sellCostBuyPrice+10000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 10500, 10000, 10000
                    , 10000, 10000, 10000, 10000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10000, 10000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10500, sellCostBuyPrice =sellCostBuyPrice+10000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '1010';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1010', '1', '25', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '25', '0', '1', '2026-10-09 20:38:43','0','0'); -- id=4368
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','09633', '372', '24', '886', '10.00', '380', '3800', '0', '', '0', '2026-10-09 20:38:43', '886', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','380','3800','0','','0','0.00','0','0','0','0'); -- id=1338
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 1338;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (886, '2026-10-09', 3800, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3800, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3800, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3800, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '886';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('886', '1', '10', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '10', '1', '2026-10-09 20:38:43','0','0'); -- id=4369
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','00358', '372', '18', '817', '15.00', '290', '4350', '0', '', '0', '2026-10-09 20:38:43', '817', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','290','4350','0','','0','0.00','0','0','0','0'); -- id=1339
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1339;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (817, '2026-10-09', 4350, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4350, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-10-09', 4350, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4350, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '199', userid = '1', storedetaildate = '2026-10-09 20:38:43' WHERE storedetailid = '817';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('817', '1', '15', '1', '372', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '214', '199', '1', '2026-10-09 20:38:43','0','0'); -- id=4370
UPDATE dailyentry SET totalcreditor = '75530.00', totaldebtor = '75530.00', thedate = '2026-10-09', userid = '2', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 18:43:36', entryComment = 'اضافة فاتورة مبيعات رقم 363', fromFlag = '1',related='0',isopeningentry='0',operationId='363',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=363' WHERE id = '1871';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '75530.00', '75530.00', '2026-10-09', '1', '0', '1871', '2026-10-09 20:38:43','تم عكس القيد رقم 1871 ','1','0','-1','0','0',''); -- id=1909
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1909', '419', '75530.00', '','0'); -- id=1911
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '2159595', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1909', '143', '75530.00', '','0'); -- id=1944
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3763615', 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 = '72360.00', totaldebtor = '72360.00', thedate = '2026-10-09', userid = '2', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 18:43:36', entryComment = 'اضافة فاتورة مبيعات رقم 363 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='363',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=363' WHERE id = '1872';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '72360.00', '72360.00', '2026-10-09', '1', '0', '1872', '2026-10-09 20:38:43','تم عكس القيد رقم 1872 ','1','0','-1','0','0',''); -- id=1910
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1910', '402', '72360.00', '','0'); -- id=1912
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3534801.33', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1910', '382', '72360.00', '','0'); -- id=1945
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20421387.87', 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 ( '75530', '75530', '2026-10-09', '1', '0', '0', '2026-10-09 20:38:43','اضافة فاتورة مبيعات رقم 372','1','0',null,'0','372','sellbillController.php?do=showDetail&sellbillid=372'); -- id=1911
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1911', '529', '75530', '','0'); -- id=1946
UPDATE accountstree SET name = 'التركي - عميل', customName = 'التركي - عميل', customNameEn = 'التركي - عميل', nameEn = 'التركي - عميل', parent = '58', accountNature = '0', theValue = '209425', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '529';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1911', '143', '75530', '','0'); -- id=1913
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3839145', 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 ( '72360', '72360', '2026-10-09', '1', '0', '0', '2026-10-09 20:38:43','اضافة فاتورة مبيعات رقم 372 - صرف البضاعة من المخزن','1','0',null,'0','372','sellbillController.php?do=showDetail&sellbillid=372'); -- id=1912
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1912', '402', '72360', '','0'); -- id=1947
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3607161.33', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1912', '382', '72360', '','0'); -- id=1914
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20349027.87', 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='1911,0,1912' where sellbillid=372;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 75530, 71985, 72360
                    , 72426.5, 72360, 72426.5, 72360
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,72360, 70551.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75530, sellCostBuyPrice =sellCostBuyPrice+71985
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+72360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+72426.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+72360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+72426.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+72360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+72360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+70551.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 (31, '2026-10-09', 75530, 71985, 72360
                    , 72426.5, 72360, 72426.5, 72360
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,72360, 70551.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75530, sellCostBuyPrice =sellCostBuyPrice+71985
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+72360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+72426.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+72360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+72426.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+72360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+72360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+70551.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, 75530, 71985, 72360
                    , 72426.5, 72360, 72426.5, 72360, 72360, 70551.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+75530, netSellCostBuyPrice = netSellCostBuyPrice+71985
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+72360
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+72426.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+72360
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+72426.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+72360
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+72360
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+70551.5;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 363 and newid=372 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:08:43";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:38:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:38:43', '1', 'editprint', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editprint&id=372'); -- id=6562
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:08:48";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:38:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:38:48', '1', 'editsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=365'); -- id=6563
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:09:03";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:39:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:39:03', '1', 'update', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=update'); -- id=6564
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 365;
UPDATE sellbill SET  sellbillsysdate = '2026-10-09 20:39:04', userid = '2',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '365';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 530;
UPDATE sellbilldetail SET  lastbuyprice = 540.00 , meanbuyprice = 540.00, lastbuyprice_withDiscount = 496.80, meanbuyprice_withDiscount = 496.80
        , lastbuyprice_withTax = 540, meanbuyprice_withTax = 540, lastbuyprice_withDiscountAndTax = 496.8
                where sellbilldetailid = 1272;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1628, '2026-10-09', 1620, 1620, 1620
                    , 1620, 1490.4, 1490.4, 1490.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 1620, 1620, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1620, sellCostBuyPrice =sellCostBuyPrice-1620
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1620, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1620
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1490.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1490.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1490.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1620
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1620
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1620, 1620, 1620
                    , 1620, 1490.4, 1490.4, 1490.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1620, 1620, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1620, sellCostBuyPrice =sellCostBuyPrice-1620
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1620, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1620
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1490.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1490.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1490.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1620
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1620
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '1653';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1628', '1', '3', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '21', '24', '1', '2026-10-09 19:08:05','0','0'); -- id=4371
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-12 where id = 777;
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 423.20, meanbuyprice_withDiscount = 423.20
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 423.2
                where sellbilldetailid = 1273;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1795, '2026-10-09', 5520, 5520, 5520
                    , 5520, 5078.4, 5078.4, 5078.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,12,0, 5520, 5520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5520, sellCostBuyPrice =sellCostBuyPrice-5520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5520, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5078.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5078.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5078.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5520
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-12
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5520, 5520, 5520
                    , 5520, 5078.4, 5078.4, 5078.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5520, 5520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5520, sellCostBuyPrice =sellCostBuyPrice-5520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5520, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5078.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5078.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5078.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5520
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2808';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1795', '1', '12', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '9', '21', '1', '2026-10-09 19:08:05','0','0'); -- id=4372
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 555;
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1274;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1691, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1350, sellCostBuyPrice =sellCostBuyPrice-1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1350, sellCostBuyPrice =sellCostBuyPrice-1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2703';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1691', '1', '3', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '3', '1', '2026-10-09 19:08:05','0','0'); -- id=4373
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 684;
UPDATE sellbilldetail SET  lastbuyprice = 490.00 , meanbuyprice = 490.00, lastbuyprice_withDiscount = 490.00, meanbuyprice_withDiscount = 490.00
        , lastbuyprice_withTax = 490, meanbuyprice_withTax = 490, lastbuyprice_withDiscountAndTax = 490
                where sellbilldetailid = 1275;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1770, '2026-10-09', 2120, 1960, 1960
                    , 1960, 1960, 1960, 1960
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 1960, 1960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2120, sellCostBuyPrice =sellCostBuyPrice-1960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1960, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1960
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2120, 1960, 1960
                    , 1960, 1960, 1960, 1960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1960, 1960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2120, sellCostBuyPrice =sellCostBuyPrice-1960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1960, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1960
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2783';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1770', '1', '4', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '36', '40', '1', '2026-10-09 19:08:05','0','0'); -- id=4374
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 531;
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1276;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1629, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1350, sellCostBuyPrice =sellCostBuyPrice-1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1350, sellCostBuyPrice =sellCostBuyPrice-1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '1654';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1629', '1', '3', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '21', '24', '1', '2026-10-09 19:08:05','0','0'); -- id=4375
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-12 where id = 738;
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 280.00, lastbuyprice_withDiscount = 252.00, meanbuyprice_withDiscount = 252.00
        , lastbuyprice_withTax = 280, meanbuyprice_withTax = 280, lastbuyprice_withDiscountAndTax = 252
                where sellbilldetailid = 1277;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1780, '2026-10-09', 3360, 3360, 3360
                    , 3360, 3024, 3024, 3024
                    , 0, 0, 0, 0
                    , 0, 0, 0,12,0, 3360, 3360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3360, sellCostBuyPrice =sellCostBuyPrice-3360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3360, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3024, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3024
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3024
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3360
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-12
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3360, 3360, 3360
                    , 3360, 3024, 3024, 3024
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3360, 3360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3360, sellCostBuyPrice =sellCostBuyPrice-3360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3360, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3024, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3024
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3024
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3360
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2793';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1780', '1', '12', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '24', '36', '1', '2026-10-09 19:08:05','0','0'); -- id=4376
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 212;
UPDATE sellbilldetail SET  lastbuyprice = 510.00 , meanbuyprice = 507.50, lastbuyprice_withDiscount = 510.00, meanbuyprice_withDiscount = 507.50
        , lastbuyprice_withTax = 507.5, meanbuyprice_withTax = 507.5, lastbuyprice_withDiscountAndTax = 510
                where sellbilldetailid = 1278;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1431, '2026-10-09', 1620, 1515, 1530
                    , 1522.5, 1530, 1522.5, 1530
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 1522.5, 1522.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1620, sellCostBuyPrice =sellCostBuyPrice-1515
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1530, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1522.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1522.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1530
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1522.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1522.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-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1620, 1515, 1530
                    , 1522.5, 1530, 1522.5, 1530
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1522.5, 1522.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1620, sellCostBuyPrice =sellCostBuyPrice-1515
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1530, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1522.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1522.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1530
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1522.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1522.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 = '18', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '1444';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1431', '1', '3', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '15', '18', '1', '2026-10-09 19:08:05','0','0'); -- id=4377
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 520;
UPDATE sellbilldetail SET  lastbuyprice = 590.00 , meanbuyprice = 590.00, lastbuyprice_withDiscount = 542.80, meanbuyprice_withDiscount = 542.80
        , lastbuyprice_withTax = 590, meanbuyprice_withTax = 590, lastbuyprice_withDiscountAndTax = 542.8
                where sellbilldetailid = 1279;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1671, '2026-10-09', 1770, 1770, 1770
                    , 1770, 1628.4, 1628.4, 1628.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 1770, 1770, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1770, sellCostBuyPrice =sellCostBuyPrice-1770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1770, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1770
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1628.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1628.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1628.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1770
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1770
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1770, 1770, 1770
                    , 1770, 1628.4, 1628.4, 1628.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1770, 1770, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1770, sellCostBuyPrice =sellCostBuyPrice-1770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1770, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1770
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1628.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1628.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1628.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1770
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1770
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2683';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1671', '1', '3', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '24', '27', '1', '2026-10-09 19:08:05','0','0'); -- id=4378
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 672;
UPDATE sellbilldetail SET  lastbuyprice = 470.00 , meanbuyprice = 470.00, lastbuyprice_withDiscount = 470.00, meanbuyprice_withDiscount = 470.00
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 470
                where sellbilldetailid = 1280;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1758, '2026-10-09', 2040, 1880, 1880
                    , 1880, 1880, 1880, 1880
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 1880, 1880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2040, sellCostBuyPrice =sellCostBuyPrice-1880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1880, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1880
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2040, 1880, 1880
                    , 1880, 1880, 1880, 1880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1880, 1880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2040, sellCostBuyPrice =sellCostBuyPrice-1880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1880, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1880
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2771';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1758', '1', '4', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '28', '32', '1', '2026-10-09 19:08:05','0','0'); -- id=4379
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 213;
UPDATE sellbilldetail SET  lastbuyprice = 485.00 , meanbuyprice = 482.50, lastbuyprice_withDiscount = 485.00, meanbuyprice_withDiscount = 482.50
        , lastbuyprice_withTax = 482.5, meanbuyprice_withTax = 482.5, lastbuyprice_withDiscountAndTax = 485
                where sellbilldetailid = 1281;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1432, '2026-10-09', 1545, 1440, 1455
                    , 1447.5, 1455, 1447.5, 1455
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 1447.5, 1447.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1545, sellCostBuyPrice =sellCostBuyPrice-1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1455, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1447.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1455, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1447.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1455
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1447.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1447.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-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1545, 1440, 1455
                    , 1447.5, 1455, 1447.5, 1455
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1447.5, 1447.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1545, sellCostBuyPrice =sellCostBuyPrice-1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1455, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1447.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1455, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1447.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1455
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1447.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1447.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 = '15', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '1445';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1432', '1', '3', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '12', '15', '1', '2026-10-09 19:08:05','0','0'); -- id=4380
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 777;
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 423.20, meanbuyprice_withDiscount = 423.20
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 423.2
                where sellbilldetailid = 1282;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1795, '2026-10-09', 1380, 1380, 1380
                    , 1380, 1269.6, 1269.6, 1269.6
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1380, sellCostBuyPrice =sellCostBuyPrice-1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1269.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1269.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1269.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1380
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1380, 1380, 1380
                    , 1380, 1269.6, 1269.6, 1269.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1380, sellCostBuyPrice =sellCostBuyPrice-1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1269.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1269.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1269.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1380
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2808';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1795', '1', '3', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '21', '24', '1', '2026-10-09 19:08:05','0','0'); -- id=4381
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 531;
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1283;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1629, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1350, sellCostBuyPrice =sellCostBuyPrice-1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1350, sellCostBuyPrice =sellCostBuyPrice-1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '1654';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1629', '1', '3', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '24', '27', '1', '2026-10-09 19:08:05','0','0'); -- id=4382
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 625;
UPDATE sellbilldetail SET  lastbuyprice = 465.00 , meanbuyprice = 465.00, lastbuyprice_withDiscount = 427.80, meanbuyprice_withDiscount = 446.40
        , lastbuyprice_withTax = 465, meanbuyprice_withTax = 232.5, lastbuyprice_withDiscountAndTax = 427.8
                where sellbilldetailid = 1284;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1726, '2026-10-09', 1395, 1395, 1395
                    , 1395, 1283.4, 1339.2, 1283.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 1395, 697.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1395, sellCostBuyPrice =sellCostBuyPrice-1395
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1395, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1395
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1283.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1339.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1283.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1395
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-697.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-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1395, 1395, 1395
                    , 1395, 1283.4, 1339.2, 1283.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1395, 697.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1395, sellCostBuyPrice =sellCostBuyPrice-1395
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1395, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1395
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1283.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1339.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1283.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1395
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-697.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 = '24', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2739';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1726', '1', '3', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '21', '24', '1', '2026-10-09 19:08:05','0','0'); -- id=4383
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 155;
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 339.99, meanbuyprice_withDiscount = 339.99
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 340, lastbuyprice_withDiscountAndTax = 339.99
                where sellbilldetailid = 1285;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1405, '2026-10-09', 1360, 1360, 1360
                    , 1360, 1359.96, 1359.96, 1359.96
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 1360, 1360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1360, sellCostBuyPrice =sellCostBuyPrice-1360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1360, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1359.96, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1359.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1359.96
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1360
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1360, 1360, 1360
                    , 1360, 1359.96, 1359.96, 1359.96
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1360, 1360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1360, sellCostBuyPrice =sellCostBuyPrice-1360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1360, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1359.96, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1359.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1359.96
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1360
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-10-09 20:39:04' WHERE storedetailid = '1418';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1405', '1', '4', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '244', '248', '1', '2026-10-09 19:08:05','0','0'); -- id=4384
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-15 where id = 581;
UPDATE sellbilldetail SET  lastbuyprice = 510.00 , meanbuyprice = 510.00, lastbuyprice_withDiscount = 510.00, meanbuyprice_withDiscount = 510.00
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 510
                where sellbilldetailid = 1286;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1718, '2026-10-09', 8025, 7650, 7650
                    , 7650, 7650, 7650, 7650
                    , 0, 0, 0, 0
                    , 0, 0, 0,15,0, 7650, 7650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-8025, sellCostBuyPrice =sellCostBuyPrice-7650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7650, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-7650
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-10-09', 8025, 7650, 7650
                    , 7650, 7650, 7650, 7650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7650, 7650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-8025, sellCostBuyPrice =sellCostBuyPrice-7650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7650, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-7650
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-10-09 20:39:04' WHERE storedetailid = '2730';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1718', '1', '15', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '102', '117', '1', '2026-10-09 19:08:05','0','0'); -- id=4385
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-9 where id = 581;
UPDATE sellbilldetail SET  lastbuyprice = 510.00 , meanbuyprice = 510.00, lastbuyprice_withDiscount = 510.00, meanbuyprice_withDiscount = 510.00
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 510
                where sellbilldetailid = 1287;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1718, '2026-10-09', 4815, 4590, 4590
                    , 4590, 4590, 4590, 4590
                    , 0, 0, 0, 0
                    , 0, 0, 0,9,0, 4590, 4590, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4815, sellCostBuyPrice =sellCostBuyPrice-4590
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4590, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4590
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4590, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4590
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4590
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4590
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4590
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-9
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4815, 4590, 4590
                    , 4590, 4590, 4590, 4590
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4590, 4590, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4815, sellCostBuyPrice =sellCostBuyPrice-4590
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4590, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4590
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4590, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4590
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4590
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4590
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4590
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '126', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2730';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1718', '1', '9', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '117', '126', '1', '2026-10-09 19:08:05','0','0'); -- id=4386
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-8 where id = 675;
UPDATE sellbilldetail SET  lastbuyprice = 470.00 , meanbuyprice = 470.00, lastbuyprice_withDiscount = 470.00, meanbuyprice_withDiscount = 470.00
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 470
                where sellbilldetailid = 1288;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1761, '2026-10-09', 4080, 3760, 3760
                    , 3760, 3760, 3760, 3760
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 3760, 3760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4080, sellCostBuyPrice =sellCostBuyPrice-3760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3760, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3760
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-8
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4080, 3760, 3760
                    , 3760, 3760, 3760, 3760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3760, 3760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4080, sellCostBuyPrice =sellCostBuyPrice-3760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3760, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3760
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1761', '1', '8', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '24', '32', '1', '2026-10-09 19:08:05','0','0'); -- id=4387
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-8 where id = 683;
UPDATE sellbilldetail SET  lastbuyprice = 980.00 , meanbuyprice = 980.00, lastbuyprice_withDiscount = 980.00, meanbuyprice_withDiscount = 980.00
        , lastbuyprice_withTax = 980, meanbuyprice_withTax = 980, lastbuyprice_withDiscountAndTax = 980
                where sellbilldetailid = 1289;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1769, '2026-10-09', 8400, 7840, 7840
                    , 7840, 7840, 7840, 7840
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 7840, 7840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-8400, sellCostBuyPrice =sellCostBuyPrice-7840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7840, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-7840
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-8
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 8400, 7840, 7840
                    , 7840, 7840, 7840, 7840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7840, 7840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-8400, sellCostBuyPrice =sellCostBuyPrice-7840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7840, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-7840
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2782';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1769', '1', '8', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '8', '16', '1', '2026-10-09 19:08:05','0','0'); -- id=4388
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 516;
UPDATE sellbilldetail SET  lastbuyprice = 475.00 , meanbuyprice = 475.00, lastbuyprice_withDiscount = 437.00, meanbuyprice_withDiscount = 437.00
        , lastbuyprice_withTax = 475, meanbuyprice_withTax = 475, lastbuyprice_withDiscountAndTax = 437
                where sellbilldetailid = 1290;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1667, '2026-10-09', 2850, 2850, 2850
                    , 2850, 2622, 2622, 2622
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2850, sellCostBuyPrice =sellCostBuyPrice-2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2622, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2622
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2622
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2850
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2850, 2850, 2850
                    , 2850, 2622, 2622, 2622
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2850, sellCostBuyPrice =sellCostBuyPrice-2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2622, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2622
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2622
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2850
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2679';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1667', '1', '6', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '6', '1', '2026-10-09 19:08:05','0','0'); -- id=4389
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 778;
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1291;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1796, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1350, sellCostBuyPrice =sellCostBuyPrice-1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1350, sellCostBuyPrice =sellCostBuyPrice-1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2809';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1796', '1', '3', '0', '365', 'تعديل فاتورة مبيعات', 'sellbillController.php', '6', '9', '1', '2026-10-09 19:08:05','0','0'); -- id=4390
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0.00','1','تعديل فاتورة مبيعات','365', '0', '2026-10-09 19:08:05', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '57300', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 19:08:05','0','0','',''); -- id=492
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2102298',  userid = '1' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('2159598','57300', '1', '2', 'تعديل فاتورة مبيعات', '365', '2102298', '2026-10-09 20:39:04', '1',  'sellbillController.php','1','','0'); -- id=429
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 57300, 55290, 55320
                    , 55305, 53389.16, 53429.96, 53389.16
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,55305, 54607.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-57300, sellCostBuyPrice =sellCostBuyPrice-55290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-55320, sellCostMeanBuyPrice = sellCostMeanBuyPrice-55305
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-53389.16, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-53429.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-53389.16
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-55305
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-54607.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-10-09', 57300, 55290, 55320
                    , 55305, 53389.16, 53429.96, 53389.16
                    , 0, 0, 0, 0
                    , 0, 0, 0, 55305, 54607.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-57300, sellCostBuyPrice =sellCostBuyPrice-55290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-55320, sellCostMeanBuyPrice = sellCostMeanBuyPrice-55305
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-53389.16, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-53429.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-53389.16
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-55305
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-54607.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, 57300, 55290, 55320
                    , 55305, 53389.16, 53429.96, 53389.16, 55305, 54607.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-57300, netSellCostBuyPrice = netSellCostBuyPrice-55290
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-55320
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-55305
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-53389.16
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-53429.96
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-53389.16
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-55305
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-54607.5;

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


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

COMMIT;
BEGIN;
CALL clientInUse(31,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 19:08:05', '06ac90c2c9d0f7', '31', '882170.00', '939470', '0', '1', '57300', '57300', '0', '57300', '1', '2026-10-09 19:08:05', '', '1', '0', 'التركي - عميل', '2', '1', '3', '0', 'التركي - عميل', '112', '365', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-09','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=373
UPDATE client SET  clientdebt = '939470', userid = '1' WHERE clientid = '31';
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 ('31','882170.00','57300','0','اضافة فاتورة مبيعات (معدله)','373', '939470', '2026-10-09 20:39:04', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '57300', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 19:08:05','0','0','',''); -- id=493
UPDATE client SET  inUse = 0 where clientid = 31;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 530;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('496.8','01628', '373', '120', '1628', '3.00', '540', '1620', '0', '', '0', '2026-10-09 20:39:04', '1628', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','530-3,','1','1','0','0','540','1620','0','','0','0.00','0','0','0','0'); -- id=1340
UPDATE sellbilldetail SET  lastbuyprice = 540.00 , meanbuyprice = 540.00, lastbuyprice_withDiscount = 496.80, meanbuyprice_withDiscount = 496.80
        , lastbuyprice_withTax = 540, meanbuyprice_withTax = 540, lastbuyprice_withDiscountAndTax = 496.8
                where sellbilldetailid = 1340;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1628, '2026-10-09', 1620, 1620, 1620
                    , 1620, 1490.4, 1490.4, 1490.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1620, 1620, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1620, sellCostBuyPrice =sellCostBuyPrice+1620
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1620, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1620
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1490.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1490.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1490.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1620
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1620
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1620, 1620, 1620
                    , 1620, 1490.4, 1490.4, 1490.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1620, 1620, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1620, sellCostBuyPrice =sellCostBuyPrice+1620
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1620, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1620
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1490.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1490.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1490.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1620
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1620
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '1653';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1628', '1', '3', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '24', '21', '1', '2026-10-09 20:39:04','0','0'); -- id=4391
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 777;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('423.2','01795', '373', '126', '1795', '12.00', '460', '5520', '0', '', '0', '2026-10-09 20:39:04', '1795', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','777-12,','1','1','0','0','460','5520','0','','0','0.00','0','0','0','0'); -- id=1341
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 423.20, meanbuyprice_withDiscount = 423.20
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 423.2
                where sellbilldetailid = 1341;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1795, '2026-10-09', 5520, 5520, 5520
                    , 5520, 5078.4, 5078.4, 5078.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 5520, 5520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5520, sellCostBuyPrice =sellCostBuyPrice+5520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5078.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5078.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5078.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 5520, 5520, 5520
                    , 5520, 5078.4, 5078.4, 5078.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5520, 5520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5520, sellCostBuyPrice =sellCostBuyPrice+5520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5078.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5078.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5078.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2808';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1795', '1', '12', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '24', '12', '1', '2026-10-09 20:39:04','0','0'); -- id=4392
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 555;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','01691', '373', '126', '1691', '3.00', '450', '1350', '0', '', '0', '2026-10-09 20:39:04', '1691', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','555-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=1342
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1342;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1691, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2703';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1691', '1', '3', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '3', '0', '1', '2026-10-09 20:39:04','0','0'); -- id=4393
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 684;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('490','01770', '373', '137', '1770', '4.00', '530', '2120', '0', '', '0', '2026-10-09 20:39:04', '1770', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','684-4,','1','1','0','0','530','2120','0','','0','0.00','0','0','0','0'); -- id=1343
UPDATE sellbilldetail SET  lastbuyprice = 490.00 , meanbuyprice = 490.00, lastbuyprice_withDiscount = 490.00, meanbuyprice_withDiscount = 490.00
        , lastbuyprice_withTax = 490, meanbuyprice_withTax = 490, lastbuyprice_withDiscountAndTax = 490
                where sellbilldetailid = 1343;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1770, '2026-10-09', 2120, 1960, 1960
                    , 1960, 1960, 1960, 1960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1960, 1960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2120, sellCostBuyPrice =sellCostBuyPrice+1960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2120, 1960, 1960
                    , 1960, 1960, 1960, 1960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1960, 1960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2120, sellCostBuyPrice =sellCostBuyPrice+1960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2783';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1770', '1', '4', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '40', '36', '1', '2026-10-09 20:39:04','0','0'); -- id=4394
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 531;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','01629', '373', '120', '1629', '3.00', '450', '1350', '0', '', '0', '2026-10-09 20:39:04', '1629', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','531-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=1344
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1344;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1629, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '1654';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1629', '1', '3', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '27', '24', '1', '2026-10-09 20:39:04','0','0'); -- id=4395
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 738;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('252','01780', '373', '99', '1780', '12.00', '280', '3360', '0', '', '0', '2026-10-09 20:39:04', '1780', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','738-12,','1','1','0','0','280','3360','0','','0','0.00','0','0','0','0'); -- id=1345
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 280.00, lastbuyprice_withDiscount = 252.00, meanbuyprice_withDiscount = 252.00
        , lastbuyprice_withTax = 280, meanbuyprice_withTax = 280, lastbuyprice_withDiscountAndTax = 252
                where sellbilldetailid = 1345;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1780, '2026-10-09', 3360, 3360, 3360
                    , 3360, 3024, 3024, 3024
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3360, 3360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3024, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3024
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3024
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3360, 3360, 3360
                    , 3360, 3024, 3024, 3024
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3360, 3360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3024, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3024
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3024
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2793';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1780', '1', '12', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '36', '24', '1', '2026-10-09 20:39:04','0','0'); -- id=4396
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 212;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('510','01431', '373', '100', '1431', '3.00', '540', '1620', '0', '', '0', '2026-10-09 20:39:04', '1431', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','212-3,','1','1','0','0','540','1620','0','','0','0.00','0','0','0','0'); -- id=1346
UPDATE sellbilldetail SET  lastbuyprice = 510.00 , meanbuyprice = 507.50, lastbuyprice_withDiscount = 510.00, meanbuyprice_withDiscount = 507.50
        , lastbuyprice_withTax = 507.5, meanbuyprice_withTax = 507.5, lastbuyprice_withDiscountAndTax = 510
                where sellbilldetailid = 1346;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1431, '2026-10-09', 1620, 1515, 1530
                    , 1522.5, 1530, 1522.5, 1530
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1522.5, 1522.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1620, sellCostBuyPrice =sellCostBuyPrice+1515
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1530, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1522.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1522.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1530
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1522.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1522.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+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1620, 1515, 1530
                    , 1522.5, 1530, 1522.5, 1530
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1522.5, 1522.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1620, sellCostBuyPrice =sellCostBuyPrice+1515
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1530, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1522.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1522.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1530
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1522.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1522.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 = '15', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '1444';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1431', '1', '3', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '18', '15', '1', '2026-10-09 20:39:04','0','0'); -- id=4397
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 520;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('542.8','01671', '373', '124', '1671', '3.00', '590', '1770', '0', '', '0', '2026-10-09 20:39:04', '1671', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','520-3,','1','1','0','0','590','1770','0','','0','0.00','0','0','0','0'); -- id=1347
UPDATE sellbilldetail SET  lastbuyprice = 590.00 , meanbuyprice = 590.00, lastbuyprice_withDiscount = 542.80, meanbuyprice_withDiscount = 542.80
        , lastbuyprice_withTax = 590, meanbuyprice_withTax = 590, lastbuyprice_withDiscountAndTax = 542.8
                where sellbilldetailid = 1347;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1671, '2026-10-09', 1770, 1770, 1770
                    , 1770, 1628.4, 1628.4, 1628.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1770, 1770, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1770, sellCostBuyPrice =sellCostBuyPrice+1770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1770, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1770
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1628.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1628.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1628.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1770
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1770
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1770, 1770, 1770
                    , 1770, 1628.4, 1628.4, 1628.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1770, 1770, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1770, sellCostBuyPrice =sellCostBuyPrice+1770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1770, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1770
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1628.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1628.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1628.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1770
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1770
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2683';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1671', '1', '3', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '27', '24', '1', '2026-10-09 20:39:04','0','0'); -- id=4398
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 672;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('470','01758', '373', '136', '1758', '4.00', '510', '2040', '0', '', '0', '2026-10-09 20:39:04', '1758', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','672-4,','1','1','0','0','510','2040','0','','0','0.00','0','0','0','0'); -- id=1348
UPDATE sellbilldetail SET  lastbuyprice = 470.00 , meanbuyprice = 470.00, lastbuyprice_withDiscount = 470.00, meanbuyprice_withDiscount = 470.00
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 470
                where sellbilldetailid = 1348;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1758, '2026-10-09', 2040, 1880, 1880
                    , 1880, 1880, 1880, 1880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1880, 1880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2040, sellCostBuyPrice =sellCostBuyPrice+1880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2040, 1880, 1880
                    , 1880, 1880, 1880, 1880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1880, 1880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2040, sellCostBuyPrice =sellCostBuyPrice+1880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2771';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1758', '1', '4', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '32', '28', '1', '2026-10-09 20:39:04','0','0'); -- id=4399
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 213;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('485','01432', '373', '100', '1432', '3.00', '515', '1545', '0', '', '0', '2026-10-09 20:39:04', '1432', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','213-3,','1','1','0','0','515','1545','0','','0','0.00','0','0','0','0'); -- id=1349
UPDATE sellbilldetail SET  lastbuyprice = 485.00 , meanbuyprice = 482.50, lastbuyprice_withDiscount = 485.00, meanbuyprice_withDiscount = 482.50
        , lastbuyprice_withTax = 482.5, meanbuyprice_withTax = 482.5, lastbuyprice_withDiscountAndTax = 485
                where sellbilldetailid = 1349;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1432, '2026-10-09', 1545, 1440, 1455
                    , 1447.5, 1455, 1447.5, 1455
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1447.5, 1447.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1545, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1455, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1447.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1455, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1447.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1455
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1447.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1447.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+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1545, 1440, 1455
                    , 1447.5, 1455, 1447.5, 1455
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1447.5, 1447.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1545, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1455, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1447.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1455, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1447.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1455
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1447.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1447.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 = '12', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '1445';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1432', '1', '3', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '15', '12', '1', '2026-10-09 20:39:04','0','0'); -- id=4400
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 777;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('423.2','01795', '373', '126', '1795', '3.00', '460', '1380', '0', '', '0', '2026-10-09 20:39:04', '1795', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','777-3,','1','1','0','0','460','1380','0','','0','0.00','0','0','0','0'); -- id=1350
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 423.20, meanbuyprice_withDiscount = 423.20
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 423.2
                where sellbilldetailid = 1350;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1795, '2026-10-09', 1380, 1380, 1380
                    , 1380, 1269.6, 1269.6, 1269.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1269.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1269.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1269.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1380, 1380, 1380
                    , 1380, 1269.6, 1269.6, 1269.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1269.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1269.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1269.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2808';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1795', '1', '3', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '12', '9', '1', '2026-10-09 20:39:04','0','0'); -- id=4401
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 531;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','01629', '373', '120', '1629', '3.00', '450', '1350', '0', '', '0', '2026-10-09 20:39:04', '1629', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','531-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=1351
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1351;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1629, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '1654';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1629', '1', '3', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '24', '21', '1', '2026-10-09 20:39:04','0','0'); -- id=4402
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 625;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('427.8','01726', '373', '132', '1726', '3.00', '465', '1395', '0', '', '0', '2026-10-09 20:39:04', '1726', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','625-3,','1','1','0','0','465','1395','0','','0','0.00','0','0','0','0'); -- id=1352
UPDATE sellbilldetail SET  lastbuyprice = 465.00 , meanbuyprice = 465.00, lastbuyprice_withDiscount = 427.80, meanbuyprice_withDiscount = 446.40
        , lastbuyprice_withTax = 465, meanbuyprice_withTax = 232.5, lastbuyprice_withDiscountAndTax = 427.8
                where sellbilldetailid = 1352;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1726, '2026-10-09', 1395, 1395, 1395
                    , 1395, 1283.4, 1339.2, 1283.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1395, 697.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1395, sellCostBuyPrice =sellCostBuyPrice+1395
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1395, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1395
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1283.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1339.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1283.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1395
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+697.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+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1395, 1395, 1395
                    , 1395, 1283.4, 1339.2, 1283.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1395, 697.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1395, sellCostBuyPrice =sellCostBuyPrice+1395
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1395, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1395
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1283.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1339.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1283.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1395
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+697.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 = '21', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2739';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1726', '1', '3', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '24', '21', '1', '2026-10-09 20:39:04','0','0'); -- id=4403
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 155;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('339.99','01405', '373', '99', '1405', '4.00', '340', '1360', '0', '', '0', '2026-10-09 20:39:04', '1405', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','155-4,','1','1','0','0','340','1360','0','','0','0.00','0','0','0','0'); -- id=1353
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 339.99, meanbuyprice_withDiscount = 339.99
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 340, lastbuyprice_withDiscountAndTax = 339.99
                where sellbilldetailid = 1353;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1405, '2026-10-09', 1360, 1360, 1360
                    , 1360, 1359.96, 1359.96, 1359.96
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1360, 1360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1360, sellCostBuyPrice =sellCostBuyPrice+1360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1359.96, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1359.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1359.96
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1360, 1360, 1360
                    , 1360, 1359.96, 1359.96, 1359.96
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1360, 1360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1360, sellCostBuyPrice =sellCostBuyPrice+1360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1359.96, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1359.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1359.96
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '244', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '1418';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1405', '1', '4', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '248', '244', '1', '2026-10-09 20:39:04','0','0'); -- id=4404
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 581;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('510','01718', '373', '131', '1718', '15.00', '535', '8025', '0', '', '0', '2026-10-09 20:39:04', '1718', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','581-15,','1','1','0','0','535','8025','0','','0','0.00','0','0','0','0'); -- id=1354
UPDATE sellbilldetail SET  lastbuyprice = 510.00 , meanbuyprice = 510.00, lastbuyprice_withDiscount = 510.00, meanbuyprice_withDiscount = 510.00
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 510
                where sellbilldetailid = 1354;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1718, '2026-10-09', 8025, 7650, 7650
                    , 7650, 7650, 7650, 7650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 7650, 7650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8025, sellCostBuyPrice =sellCostBuyPrice+7650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-10-09', 8025, 7650, 7650
                    , 7650, 7650, 7650, 7650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7650, 7650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8025, sellCostBuyPrice =sellCostBuyPrice+7650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-10-09 20:39:04' WHERE storedetailid = '2730';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1718', '1', '15', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '126', '111', '1', '2026-10-09 20:39:04','0','0'); -- id=4405
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 581;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('510','01718', '373', '131', '1718', '9.00', '535', '4815', '0', '', '0', '2026-10-09 20:39:04', '1718', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','581-9,','1','1','0','0','535','4815','0','','0','0.00','0','0','0','0'); -- id=1355
UPDATE sellbilldetail SET  lastbuyprice = 510.00 , meanbuyprice = 510.00, lastbuyprice_withDiscount = 510.00, meanbuyprice_withDiscount = 510.00
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 510
                where sellbilldetailid = 1355;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1718, '2026-10-09', 4815, 4590, 4590
                    , 4590, 4590, 4590, 4590
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4590, 4590, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4815, sellCostBuyPrice =sellCostBuyPrice+4590
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4590, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4590
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4590, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4590
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4590
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4590
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4590
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4815, 4590, 4590
                    , 4590, 4590, 4590, 4590
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4590, 4590, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4815, sellCostBuyPrice =sellCostBuyPrice+4590
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4590, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4590
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4590, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4590
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4590
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4590
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4590
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '102', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2730';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1718', '1', '9', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '111', '102', '1', '2026-10-09 20:39:04','0','0'); -- id=4406
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 675;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('470','01761', '373', '136', '1761', '8.00', '510', '4080', '0', '', '0', '2026-10-09 20:39:04', '1761', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','675-8,','1','1','0','0','510','4080','0','','0','0.00','0','0','0','0'); -- id=1356
UPDATE sellbilldetail SET  lastbuyprice = 470.00 , meanbuyprice = 470.00, lastbuyprice_withDiscount = 470.00, meanbuyprice_withDiscount = 470.00
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 470
                where sellbilldetailid = 1356;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1761, '2026-10-09', 4080, 3760, 3760
                    , 3760, 3760, 3760, 3760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 3760, 3760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4080, sellCostBuyPrice =sellCostBuyPrice+3760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 4080, 3760, 3760
                    , 3760, 3760, 3760, 3760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3760, 3760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4080, sellCostBuyPrice =sellCostBuyPrice+3760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1761', '1', '8', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '32', '24', '1', '2026-10-09 20:39:04','0','0'); -- id=4407
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 683;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('980','01769', '373', '137', '1769', '8.00', '1050', '8400', '0', '', '0', '2026-10-09 20:39:04', '1769', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','683-8,','1','1','0','0','1050','8400','0','','0','0.00','0','0','0','0'); -- id=1357
UPDATE sellbilldetail SET  lastbuyprice = 980.00 , meanbuyprice = 980.00, lastbuyprice_withDiscount = 980.00, meanbuyprice_withDiscount = 980.00
        , lastbuyprice_withTax = 980, meanbuyprice_withTax = 980, lastbuyprice_withDiscountAndTax = 980
                where sellbilldetailid = 1357;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1769, '2026-10-09', 8400, 7840, 7840
                    , 7840, 7840, 7840, 7840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 7840, 7840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8400, sellCostBuyPrice =sellCostBuyPrice+7840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 8400, 7840, 7840
                    , 7840, 7840, 7840, 7840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7840, 7840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8400, sellCostBuyPrice =sellCostBuyPrice+7840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2782';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1769', '1', '8', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '16', '8', '1', '2026-10-09 20:39:04','0','0'); -- id=4408
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 516;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('437','01667', '373', '124', '1667', '6.00', '475', '2850', '0', '', '0', '2026-10-09 20:39:04', '1667', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','516-6,','1','1','0','0','475','2850','0','','0','0.00','0','0','0','0'); -- id=1358
UPDATE sellbilldetail SET  lastbuyprice = 475.00 , meanbuyprice = 475.00, lastbuyprice_withDiscount = 437.00, meanbuyprice_withDiscount = 437.00
        , lastbuyprice_withTax = 475, meanbuyprice_withTax = 475, lastbuyprice_withDiscountAndTax = 437
                where sellbilldetailid = 1358;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1667, '2026-10-09', 2850, 2850, 2850
                    , 2850, 2622, 2622, 2622
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2850, sellCostBuyPrice =sellCostBuyPrice+2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2622, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2622
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2622
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2850, 2850, 2850
                    , 2850, 2622, 2622, 2622
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2850, sellCostBuyPrice =sellCostBuyPrice+2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2622, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2622
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2622
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2679';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1667', '1', '6', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '6', '0', '1', '2026-10-09 20:39:04','0','0'); -- id=4409
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 778;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','i0001796', '373', '126', '1796', '3.00', '450', '1350', '0', '', '0', '2026-10-09 20:39:04', '1796', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','778-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=1359
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 1359;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1796, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1350, 1350, 1350
                    , 1350, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2026-10-09 20:39:04' WHERE storedetailid = '2809';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1796', '1', '3', '1', '373', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '9', '6', '1', '2026-10-09 20:39:04','0','0'); -- id=4410
UPDATE dailyentry SET totalcreditor = '57300.00', totaldebtor = '57300.00', thedate = '2026-10-09', userid = '2', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 19:08:05', entryComment = 'اضافة فاتورة مبيعات رقم 365', fromFlag = '1',related='0',isopeningentry='0',operationId='365',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=365' WHERE id = '1877';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '57300.00', '57300.00', '2026-10-09', '1', '0', '1877', '2026-10-09 20:39:04','تم عكس القيد رقم 1877 ','1','0','-1','0','0',''); -- id=1913
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1913', '419', '57300.00', '','0'); -- id=1915
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '2102295', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1913', '143', '57300.00', '','0'); -- id=1948
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3781845', 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 = '53389.16', totaldebtor = '53389.16', thedate = '2026-10-09', userid = '2', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 19:08:05', entryComment = 'اضافة فاتورة مبيعات رقم 365 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='365',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=365' WHERE id = '1878';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '53389.16', '53389.16', '2026-10-09', '1', '0', '1878', '2026-10-09 20:39:04','تم عكس القيد رقم 1878 ','1','0','-1','0','0',''); -- id=1914
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1914', '402', '53389.16', '','0'); -- id=1916
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3553772.17', 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 ('1914', '382', '53389.16', '','0'); -- id=1949
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20402417.03', 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 ( '57300', '57300', '2026-10-09', '1', '0', '0', '2026-10-09 20:39:04','اضافة فاتورة مبيعات رقم 373','1','0',null,'0','373','sellbillController.php?do=showDetail&sellbillid=373'); -- id=1915
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1915', '529', '57300', '','0'); -- id=1950
UPDATE accountstree SET name = 'التركي - عميل', customName = 'التركي - عميل', customNameEn = 'التركي - عميل', nameEn = 'التركي - عميل', parent = '58', accountNature = '0', theValue = '266725', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '529';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1915', '143', '57300', '','0'); -- id=1917
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3839145', 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 ( '53389.16', '53389.16', '2026-10-09', '1', '0', '0', '2026-10-09 20:39:04','اضافة فاتورة مبيعات رقم 373 - صرف البضاعة من المخزن','1','0',null,'0','373','sellbillController.php?do=showDetail&sellbillid=373'); -- id=1916
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1916', '402', '53389.16', '','0'); -- id=1951
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3607161.33', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1916', '382', '53389.16', '','0'); -- id=1918
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20349027.87', 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='1915,0,1916' where sellbillid=373;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 57300, 55290, 55320
                    , 55305, 53389.16, 53429.96, 53389.16
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,55305, 54607.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+57300, sellCostBuyPrice =sellCostBuyPrice+55290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+55320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+55305
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+53389.16, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+53429.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+53389.16
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+55305
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+54607.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 (31, '2026-10-09', 57300, 55290, 55320
                    , 55305, 53389.16, 53429.96, 53389.16
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,55305, 54607.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+57300, sellCostBuyPrice =sellCostBuyPrice+55290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+55320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+55305
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+53389.16, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+53429.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+53389.16
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+55305
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+54607.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, 57300, 55290, 55320
                    , 55305, 53389.16, 53429.96, 53389.16, 55305, 54607.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+57300, netSellCostBuyPrice = netSellCostBuyPrice+55290
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+55320
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+55305
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+53389.16
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+53429.96
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+53389.16
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+55305
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+54607.5;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 365 and newid=373 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:09:04";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:39:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:39:04', '1', 'editprint', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editprint&id=373'); -- id=6565
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:09:13";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:39:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:39:13', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6566
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:09:17";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:39:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:39:17', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6567
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:09:39";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:39:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:39:39', '1', 'editsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=258'); -- id=6568
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:10:04";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:40:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:40:04', '1', 'editsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=257'); -- id=6569
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:10:20";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:40:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:40:20', '1', 'update', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=update'); -- id=6570
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 257;
UPDATE sellbill SET  sellbillsysdate = '2026-10-09 20:40:20', userid = '6',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '257';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-8 where id = 647;
UPDATE sellbilldetail SET  lastbuyprice = 750.00 , meanbuyprice = 750.00, lastbuyprice_withDiscount = 750.00, meanbuyprice_withDiscount = 750.00
        , lastbuyprice_withTax = 750, meanbuyprice_withTax = 750, lastbuyprice_withDiscountAndTax = 750
                where sellbilldetailid = 974;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1734, '2026-10-09', 6000, 6000, 6000
                    , 6000, 6000, 6000, 6000
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 6000, 6000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6000, sellCostBuyPrice =sellCostBuyPrice-6000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6000, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6000
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-8
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 6000, 6000, 6000
                    , 6000, 6000, 6000, 6000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6000, 6000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6000, sellCostBuyPrice =sellCostBuyPrice-6000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6000, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6000
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '96', userid = '1', storedetaildate = '2026-10-09 20:40:20' WHERE storedetailid = '2747';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1734', '1', '8', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '88', '96', '1', '2026-10-09 09:18:41','0','0'); -- id=4411
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-8 where id = 648;
UPDATE sellbilldetail SET  lastbuyprice = 900.00 , meanbuyprice = 900.00, lastbuyprice_withDiscount = 900.00, meanbuyprice_withDiscount = 900.00
        , lastbuyprice_withTax = 900, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 900
                where sellbilldetailid = 975;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1735, '2026-10-09', 7200, 7200, 7200
                    , 7200, 7200, 7200, 7200
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 7200, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-7200, sellCostBuyPrice =sellCostBuyPrice-7200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-8
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 7200, 7200, 7200
                    , 7200, 7200, 7200, 7200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7200, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-7200, sellCostBuyPrice =sellCostBuyPrice-7200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2026-10-09 20:40:20' WHERE storedetailid = '2748';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1735', '1', '8', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '20', '28', '1', '2026-10-09 09:18:41','0','0'); -- id=4412
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 650;
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 800
                where sellbilldetailid = 976;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1737, '2026-10-09', 3200, 3200, 3200
                    , 3200, 3200, 3200, 3200
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 3200, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3200, sellCostBuyPrice =sellCostBuyPrice-3200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3200, 3200, 3200
                    , 3200, 3200, 3200, 3200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3200, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3200, sellCostBuyPrice =sellCostBuyPrice-3200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2026-10-09 20:40:20' WHERE storedetailid = '2750';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1737', '1', '4', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '36', '40', '1', '2026-10-09 09:18:41','0','0'); -- id=4413
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 561;
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 800, lastbuyprice_withDiscountAndTax = 800
                where sellbilldetailid = 977;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1698, '2026-10-09', 2550, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2550, sellCostBuyPrice =sellCostBuyPrice-2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2400
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2550, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2550, sellCostBuyPrice =sellCostBuyPrice-2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2400
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2026-10-09 20:40:20' WHERE storedetailid = '2710';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1698', '1', '3', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '30', '33', '1', '2026-10-09 09:18:41','0','0'); -- id=4414
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 287;
UPDATE sellbilldetail SET  lastbuyprice = 720.00 , meanbuyprice = 720.00, lastbuyprice_withDiscount = 720.00, meanbuyprice_withDiscount = 720.00
        , lastbuyprice_withTax = 720, meanbuyprice_withTax = 720, lastbuyprice_withDiscountAndTax = 720
                where sellbilldetailid = 978;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1509, '2026-10-09', 2250, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2250, sellCostBuyPrice =sellCostBuyPrice-2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2160
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2250, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2250, sellCostBuyPrice =sellCostBuyPrice-2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2160
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2026-10-09 20:40:20' WHERE storedetailid = '1534';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1509', '1', '3', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '12', '15', '1', '2026-10-09 09:18:41','0','0'); -- id=4415
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0.00','1','تعديل فاتورة مبيعات','257', '0', '2026-10-09 09:18:41', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '21200', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:18:41','0','0','',''); -- id=494
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '99525',  userid = '1' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('120725','21200', '1', '4', 'تعديل فاتورة مبيعات', '257', '99525', '2026-10-09 20:40:20', '1',  'sellbillController.php','1','','0'); -- id=430
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 21200, 20960, 20960
                    , 20960, 20960, 20960, 20960
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,20960, 15760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-21200, sellCostBuyPrice =sellCostBuyPrice-20960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20960, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-15760
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 21200, 20960, 20960
                    , 20960, 20960, 20960, 20960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20960, 15760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-21200, sellCostBuyPrice =sellCostBuyPrice-20960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20960, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-15760
                        , returnSellVal = returnSellVal-0, 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, 21200, 20960, 20960
                    , 20960, 20960, 20960, 20960, 20960, 15760)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-21200, netSellCostBuyPrice = netSellCostBuyPrice-20960
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-20960
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-20960
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-20960
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-20960
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-20960
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-20960
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-15760;

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


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

COMMIT;
BEGIN;
CALL clientInUse(31,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 09:18:41', '06ac88210e347b', '31', '939470.00', '960670', '0', '1', '21200', '21200', '0', '21200', '1', '2026-10-09 09:18:41', '', '1', '0', 'التركي - عميل', '4', '1', '3', '0', 'التركي - عميل', '26', '257', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-09','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=374
UPDATE client SET  clientdebt = '960670', userid = '1' WHERE clientid = '31';
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 ('31','939470.00','21200','0','اضافة فاتورة مبيعات (معدله)','374', '960670', '2026-10-09 20:40:20', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '21200', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 09:18:41','0','0','',''); -- id=495
UPDATE client SET  inUse = 0 where clientid = 31;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 647;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('750','01734', '374', '133', '1734', '8.00', '750', '6000', '0', '', '0', '2026-10-09 20:40:20', '1734', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','647-8,','1','1','0','0','750','6000','0','','0','0.00','0','0','0','0'); -- id=1360
UPDATE sellbilldetail SET  lastbuyprice = 750.00 , meanbuyprice = 750.00, lastbuyprice_withDiscount = 750.00, meanbuyprice_withDiscount = 750.00
        , lastbuyprice_withTax = 750, meanbuyprice_withTax = 750, lastbuyprice_withDiscountAndTax = 750
                where sellbilldetailid = 1360;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1734, '2026-10-09', 6000, 6000, 6000
                    , 6000, 6000, 6000, 6000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 6000, 6000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+6000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 6000, 6000, 6000
                    , 6000, 6000, 6000, 6000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6000, 6000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+6000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '88', userid = '1', storedetaildate = '2026-10-09 20:40:20' WHERE storedetailid = '2747';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1734', '1', '8', '1', '374', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '96', '88', '1', '2026-10-09 20:40:20','0','0'); -- id=4416
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 648;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('900','01735', '374', '133', '1735', '8.00', '900', '7200', '0', '', '0', '2026-10-09 20:40:20', '1735', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','648-8,','1','1','0','0','900','7200','0','','0','0.00','0','0','0','0'); -- id=1361
UPDATE sellbilldetail SET  lastbuyprice = 900.00 , meanbuyprice = 900.00, lastbuyprice_withDiscount = 900.00, meanbuyprice_withDiscount = 900.00
        , lastbuyprice_withTax = 900, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 900
                where sellbilldetailid = 1361;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1735, '2026-10-09', 7200, 7200, 7200
                    , 7200, 7200, 7200, 7200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 7200, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7200, sellCostBuyPrice =sellCostBuyPrice+7200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 7200, 7200, 7200
                    , 7200, 7200, 7200, 7200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7200, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7200, sellCostBuyPrice =sellCostBuyPrice+7200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-10-09 20:40:20' WHERE storedetailid = '2748';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1735', '1', '8', '1', '374', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '28', '20', '1', '2026-10-09 20:40:20','0','0'); -- id=4417
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 650;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('800','01737', '374', '133', '1737', '4.00', '800', '3200', '0', '', '0', '2026-10-09 20:40:20', '1737', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','650-4,','1','1','0','0','800','3200','0','','0','0.00','0','0','0','0'); -- id=1362
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 800
                where sellbilldetailid = 1362;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1737, '2026-10-09', 3200, 3200, 3200
                    , 3200, 3200, 3200, 3200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 3200, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3200, sellCostBuyPrice =sellCostBuyPrice+3200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3200, 3200, 3200
                    , 3200, 3200, 3200, 3200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3200, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3200, sellCostBuyPrice =sellCostBuyPrice+3200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-10-09 20:40:20' WHERE storedetailid = '2750';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1737', '1', '4', '1', '374', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '40', '36', '1', '2026-10-09 20:40:20','0','0'); -- id=4418
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 561;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('800','01698', '374', '130', '1698', '3.00', '850', '2550', '0', '', '0', '2026-10-09 20:40:20', '1698', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','561-3,','1','1','0','0','850','2550','0','','0','0.00','0','0','0','0'); -- id=1363
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 800, lastbuyprice_withDiscountAndTax = 800
                where sellbilldetailid = 1363;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1698, '2026-10-09', 2550, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2550, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-09 20:40:20' WHERE storedetailid = '2710';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1698', '1', '3', '1', '374', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '33', '30', '1', '2026-10-09 20:40:20','0','0'); -- id=4419
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 287;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('720','01509', '374', '109', '1509', '3.00', '750', '2250', '0', '', '0', '2026-10-09 20:40:20', '1509', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','287-3,','1','1','0','0','750','2250','0','','0','0.00','0','0','0','0'); -- id=1364
UPDATE sellbilldetail SET  lastbuyprice = 720.00 , meanbuyprice = 720.00, lastbuyprice_withDiscount = 720.00, meanbuyprice_withDiscount = 720.00
        , lastbuyprice_withTax = 720, meanbuyprice_withTax = 720, lastbuyprice_withDiscountAndTax = 720
                where sellbilldetailid = 1364;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1509, '2026-10-09', 2250, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2250, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2250, 2160, 2160
                    , 2160, 2160, 2160, 2160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2250, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-10-09 20:40:20' WHERE storedetailid = '1534';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1509', '1', '3', '1', '374', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '15', '12', '1', '2026-10-09 20:40:20','0','0'); -- id=4420
UPDATE dailyentry SET totalcreditor = '21200.00', totaldebtor = '21200.00', thedate = '2026-10-09', userid = '6', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 09:18:42', entryComment = 'اضافة فاتورة مبيعات رقم 257', fromFlag = '1',related='0',isopeningentry='0',operationId='257',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=257' WHERE id = '1635';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '21200.00', '21200.00', '2026-10-09', '1', '0', '1635', '2026-10-09 20:40:20','تم عكس القيد رقم 1635 ','1','0','-1','0','0',''); -- id=1917
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1917', '568', '21200.00', '','0'); -- id=1919
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '99525', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1917', '143', '21200.00', '','0'); -- id=1952
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3817945', 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 = '20960.00', totaldebtor = '20960.00', thedate = '2026-10-09', userid = '6', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 09:18:42', entryComment = 'اضافة فاتورة مبيعات رقم 257 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='257',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=257' WHERE id = '1636';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '20960.00', '20960.00', '2026-10-09', '1', '0', '1636', '2026-10-09 20:40:20','تم عكس القيد رقم 1636 ','1','0','-1','0','0',''); -- id=1918
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1918', '402', '20960.00', '','0'); -- id=1920
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3586201.33', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1918', '382', '20960.00', '','0'); -- id=1953
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20369987.87', 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 ( '21200', '21200', '2026-10-09', '1', '0', '0', '2026-10-09 20:40:20','اضافة فاتورة مبيعات رقم 374','1','0',null,'0','374','sellbillController.php?do=showDetail&sellbillid=374'); -- id=1919
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1919', '529', '21200', '','0'); -- id=1954
UPDATE accountstree SET name = 'التركي - عميل', customName = 'التركي - عميل', customNameEn = 'التركي - عميل', nameEn = 'التركي - عميل', parent = '58', accountNature = '0', theValue = '287925', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '529';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1919', '143', '21200', '','0'); -- id=1921
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3839145', 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 ( '20960', '20960', '2026-10-09', '1', '0', '0', '2026-10-09 20:40:20','اضافة فاتورة مبيعات رقم 374 - صرف البضاعة من المخزن','1','0',null,'0','374','sellbillController.php?do=showDetail&sellbillid=374'); -- id=1920
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1920', '402', '20960', '','0'); -- id=1955
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3607161.33', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1920', '382', '20960', '','0'); -- id=1922
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20349027.87', 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='1919,0,1920' where sellbillid=374;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 21200, 20960, 20960
                    , 20960, 20960, 20960, 20960
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,20960, 15760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21200, sellCostBuyPrice =sellCostBuyPrice+20960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15760
                        , returnSellVal = returnSellVal+0, 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 (31, '2026-10-09', 21200, 20960, 20960
                    , 20960, 20960, 20960, 20960
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,20960, 15760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21200, sellCostBuyPrice =sellCostBuyPrice+20960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15760
                        , returnSellVal = returnSellVal+0, 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, 21200, 20960, 20960
                    , 20960, 20960, 20960, 20960, 20960, 15760)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+21200, netSellCostBuyPrice = netSellCostBuyPrice+20960
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+20960
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+20960
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+20960
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+20960
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+20960
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+20960
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+15760;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:10:20";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:40:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:40:20', '1', 'editprint', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editprint&id=374'); -- id=6571
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:10:31";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:40:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:40:31', '1', 'editsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=282'); -- id=6572
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:10:46";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:40:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:40:46', '1', 'update', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=update'); -- id=6573
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 282;
UPDATE sellbill SET  sellbillsysdate = '2026-10-09 20:40:46', userid = '6',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '282';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 291;
UPDATE sellbilldetail SET  lastbuyprice = 630.00 , meanbuyprice = 630.00, lastbuyprice_withDiscount = 630.00, meanbuyprice_withDiscount = 630.00
        , lastbuyprice_withTax = 630, meanbuyprice_withTax = 630, lastbuyprice_withDiscountAndTax = 630
                where sellbilldetailid = 1050;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1513, '2026-10-09', 3960, 3780, 3780
                    , 3780, 3780, 3780, 3780
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 3780, 3780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3960, sellCostBuyPrice =sellCostBuyPrice-3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3780
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3960, 3780, 3780
                    , 3780, 3780, 3780, 3780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3780, 3780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3960, sellCostBuyPrice =sellCostBuyPrice-3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3780
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2026-10-09 20:40:46' WHERE storedetailid = '1538';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1513', '1', '6', '0', '282', 'تعديل فاتورة مبيعات', 'sellbillController.php', '27', '33', '1', '2026-10-09 10:44:25','0','0'); -- id=4421
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0.00','1','تعديل فاتورة مبيعات','282', '0', '2026-10-09 10:44:25', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '3960', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:44:25','0','0','',''); -- id=496
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '95565',  userid = '1' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('99525','3960', '1', '4', 'تعديل فاتورة مبيعات', '282', '95565', '2026-10-09 20:40:46', '1',  'sellbillController.php','1','','0'); -- id=431
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 3960, 3780, 3780
                    , 3780, 3780, 3780, 3780
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3780, 3780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3960, sellCostBuyPrice =sellCostBuyPrice-3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3780
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3960, 3780, 3780
                    , 3780, 3780, 3780, 3780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3780, 3780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3960, sellCostBuyPrice =sellCostBuyPrice-3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3780
                        , returnSellVal = returnSellVal-0, 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, 3960, 3780, 3780
                    , 3780, 3780, 3780, 3780, 3780, 3780)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-3960, netSellCostBuyPrice = netSellCostBuyPrice-3780
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-3780
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-3780
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-3780
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-3780
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-3780
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-3780
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-3780;

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


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

COMMIT;
BEGIN;
CALL clientInUse(31,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 10:44:25', '06ac89932eb647', '31', '960670.00', '964630', '0', '1', '3960', '3960', '0', '3960', '1', '2026-10-09 10:44:25', '', '1', '0', 'التركي - عميل', '4', '1', '3', '0', 'التركي - عميل', '6', '282', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-09','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=375
UPDATE client SET  clientdebt = '964630', userid = '1' WHERE clientid = '31';
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 ('31','960670.00','3960','0','اضافة فاتورة مبيعات (معدله)','375', '964630', '2026-10-09 20:40:46', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '3960', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 10:44:25','0','0','',''); -- id=497
UPDATE client SET  inUse = 0 where clientid = 31;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 291;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('630','01513', '375', '109', '1513', '6.00', '660', '3960', '0', '', '0', '2026-10-09 20:40:46', '1513', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','291-6,','1','1','0','0','660','3960','0','','0','0.00','0','0','0','0'); -- id=1365
UPDATE sellbilldetail SET  lastbuyprice = 630.00 , meanbuyprice = 630.00, lastbuyprice_withDiscount = 630.00, meanbuyprice_withDiscount = 630.00
        , lastbuyprice_withTax = 630, meanbuyprice_withTax = 630, lastbuyprice_withDiscountAndTax = 630
                where sellbilldetailid = 1365;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1513, '2026-10-09', 3960, 3780, 3780
                    , 3780, 3780, 3780, 3780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3780, 3780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3960, sellCostBuyPrice =sellCostBuyPrice+3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3960, 3780, 3780
                    , 3780, 3780, 3780, 3780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3780, 3780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3960, sellCostBuyPrice =sellCostBuyPrice+3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-10-09 20:40:46' WHERE storedetailid = '1538';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1513', '1', '6', '1', '375', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '33', '27', '1', '2026-10-09 20:40:46','0','0'); -- id=4422
UPDATE dailyentry SET totalcreditor = '3960.00', totaldebtor = '3960.00', thedate = '2026-10-09', userid = '6', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 10:44:25', entryComment = 'اضافة فاتورة مبيعات رقم 282', fromFlag = '1',related='0',isopeningentry='0',operationId='282',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=282' WHERE id = '1685';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3960.00', '3960.00', '2026-10-09', '1', '0', '1685', '2026-10-09 20:40:46','تم عكس القيد رقم 1685 ','1','0','-1','0','0',''); -- id=1921
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1921', '568', '3960.00', '','0'); -- id=1923
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '95565', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1921', '143', '3960.00', '','0'); -- id=1956
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3835185', 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 = '3780.00', totaldebtor = '3780.00', thedate = '2026-10-09', userid = '6', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 10:44:25', entryComment = 'اضافة فاتورة مبيعات رقم 282 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='282',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=282' WHERE id = '1686';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3780.00', '3780.00', '2026-10-09', '1', '0', '1686', '2026-10-09 20:40:46','تم عكس القيد رقم 1686 ','1','0','-1','0','0',''); -- id=1922
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1922', '402', '3780.00', '','0'); -- id=1924
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3603381.33', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1922', '382', '3780.00', '','0'); -- id=1957
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20352807.87', 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 ( '3960', '3960', '2026-10-09', '1', '0', '0', '2026-10-09 20:40:46','اضافة فاتورة مبيعات رقم 375','1','0',null,'0','375','sellbillController.php?do=showDetail&sellbillid=375'); -- id=1923
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1923', '529', '3960', '','0'); -- id=1958
UPDATE accountstree SET name = 'التركي - عميل', customName = 'التركي - عميل', customNameEn = 'التركي - عميل', nameEn = 'التركي - عميل', parent = '58', accountNature = '0', theValue = '291885', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '529';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1923', '143', '3960', '','0'); -- id=1925
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3839145', 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 ( '3780', '3780', '2026-10-09', '1', '0', '0', '2026-10-09 20:40:46','اضافة فاتورة مبيعات رقم 375 - صرف البضاعة من المخزن','1','0',null,'0','375','sellbillController.php?do=showDetail&sellbillid=375'); -- id=1924
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1924', '402', '3780', '','0'); -- id=1959
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3607161.33', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1924', '382', '3780', '','0'); -- id=1926
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20349027.87', 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='1923,0,1924' where sellbillid=375;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 3960, 3780, 3780
                    , 3780, 3780, 3780, 3780
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3780, 3780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3960, sellCostBuyPrice =sellCostBuyPrice+3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3780
                        , returnSellVal = returnSellVal+0, 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 (31, '2026-10-09', 3960, 3780, 3780
                    , 3780, 3780, 3780, 3780
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3780, 3780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3960, sellCostBuyPrice =sellCostBuyPrice+3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3780
                        , returnSellVal = returnSellVal+0, 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, 3960, 3780, 3780
                    , 3780, 3780, 3780, 3780, 3780, 3780)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3960, netSellCostBuyPrice = netSellCostBuyPrice+3780
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3780
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3780
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3780
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3780
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3780
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3780
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3780;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 282 and newid=375 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:10:46";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:40:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:40:46', '1', 'editprint', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editprint&id=375'); -- id=6574
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:10:53";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:40:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:40:53', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6575
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:10:56";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:40:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:40:56', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6576
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:19:35";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:49:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-09 20:49:35', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=6577
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:19:39";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:49:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:49:39', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6578
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:19:46";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:49:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:49:46', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6579
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:19:53";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:49:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:49:53', '1', 'showDetail', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=324'); -- id=6580
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:21:39";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:51:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:51:39', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6581
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:21:49";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:51:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:51:49', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6582
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:21:56";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:51:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:51:56', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=6583
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:21:59";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:51:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:51:59', '1', 'editsellBill', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=324'); -- id=6584
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:22:05";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:52:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:52:05', '1', 'update', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=update'); -- id=6585
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 324;
UPDATE sellbill SET  sellbillsysdate = '2026-10-09 20:52:05', userid = '2',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '324';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 38;
UPDATE sellbilldetail SET  lastbuyprice = 535.00 , meanbuyprice = 535.00, lastbuyprice_withDiscount = 535.00, meanbuyprice_withDiscount = 535.00
        , lastbuyprice_withTax = 535, meanbuyprice_withTax = 535, lastbuyprice_withDiscountAndTax = 535
                where sellbilldetailid = 1151;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1346, '2026-10-09', 3330, 3210, 3210
                    , 3210, 3210, 3210, 3210
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 3210, 3210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3330, sellCostBuyPrice =sellCostBuyPrice-3210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3210, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3210
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3330, 3210, 3210
                    , 3210, 3210, 3210, 3210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3210, 3210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3330, sellCostBuyPrice =sellCostBuyPrice-3210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3210, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3210
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2026-10-09 20:52:05' WHERE storedetailid = '1346';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1346', '1', '6', '0', '324', 'تعديل فاتورة مبيعات', 'sellbillController.php', '12', '18', '1', '2026-10-09 14:15:49','0','0'); -- id=4423
UPDATE sellbilldetail SET  lastbuyprice = 365.00 , meanbuyprice = 365.00, lastbuyprice_withDiscount = 365.00, meanbuyprice_withDiscount = 365.00
        , lastbuyprice_withTax = 365, meanbuyprice_withTax = 365, lastbuyprice_withDiscountAndTax = 365
                where sellbilldetailid = 1152;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (976, '2026-10-09', 1925, 1825, 1825
                    , 1825, 1825, 1825, 1825
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 1825, 1825, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1925, sellCostBuyPrice =sellCostBuyPrice-1825
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1825, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1825
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1825, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1825
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1825
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1825
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1825
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1925, 1825, 1825
                    , 1825, 1825, 1825, 1825
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1825, 1825, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1925, sellCostBuyPrice =sellCostBuyPrice-1825
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1825, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1825
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1825, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1825
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1825
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1825
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1825
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '110', userid = '1', storedetaildate = '2026-10-09 20:52:05' WHERE storedetailid = '976';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('976', '1', '5', '0', '324', 'تعديل فاتورة مبيعات', 'sellbillController.php', '105', '110', '1', '2026-10-09 14:15:49','0','0'); -- id=4424
UPDATE sellbilldetail SET  lastbuyprice = 490.00 , meanbuyprice = 490.00, lastbuyprice_withDiscount = 490.00, meanbuyprice_withDiscount = 490.00
        , lastbuyprice_withTax = 490, meanbuyprice_withTax = 490, lastbuyprice_withDiscountAndTax = 490
                where sellbilldetailid = 1153;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1006, '2026-10-09', 3060, 2940, 2940
                    , 2940, 2940, 2940, 2940
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 2940, 2940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3060, sellCostBuyPrice =sellCostBuyPrice-2940
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2940, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2940
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2940
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2940
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3060, 2940, 2940
                    , 2940, 2940, 2940, 2940
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2940, 2940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3060, sellCostBuyPrice =sellCostBuyPrice-2940
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2940, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2940
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2940
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2940
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2026-10-09 20:52:05' WHERE storedetailid = '1006';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1006', '1', '6', '0', '324', 'تعديل فاتورة مبيعات', 'sellbillController.php', '19', '25', '1', '2026-10-09 14:15:49','0','0'); -- id=4425
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-5 where id = 65;
UPDATE sellbilldetail SET  lastbuyprice = 520.00 , meanbuyprice = 520.00, lastbuyprice_withDiscount = 520.00, meanbuyprice_withDiscount = 520.00
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 520
                where sellbilldetailid = 1154;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1367, '2026-10-09', 2700, 2600, 2600
                    , 2600, 2600, 2600, 2600
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 2600, 2600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2700, sellCostBuyPrice =sellCostBuyPrice-2600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2700, 2600, 2600
                    , 2600, 2600, 2600, 2600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2600, 2600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2700, sellCostBuyPrice =sellCostBuyPrice-2600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '67', userid = '1', storedetaildate = '2026-10-09 20:52:05' WHERE storedetailid = '1367';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1367', '1', '5', '0', '324', 'تعديل فاتورة مبيعات', 'sellbillController.php', '62', '67', '1', '2026-10-09 14:15:49','0','0'); -- id=4426
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0.00','1','تعديل فاتورة مبيعات','324', '0', '2026-10-09 14:15:49', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '3', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 14:15:49','0','0','',''); -- id=498
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2102295',  userid = '1' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('2102298','3', '1', '2', 'تعديل فاتورة مبيعات', '324', '2102295', '2026-10-09 20:52:05', '1',  'sellbillController.php','1','','0'); -- id=432
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 11015, 10575, 10575
                    , 10575, 10575, 10575, 10575
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10575, 10575, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11015, sellCostBuyPrice =sellCostBuyPrice-10575
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10575, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10575
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10575, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10575
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10575
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10575
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10575
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 11015, 10575, 10575
                    , 10575, 10575, 10575, 10575
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10575, 10575, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11015, sellCostBuyPrice =sellCostBuyPrice-10575
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10575, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10575
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10575, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10575
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10575
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10575
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10575
                        , returnSellVal = returnSellVal-0, 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, 11015, 10575, 10575
                    , 10575, 10575, 10575, 10575, 10575, 10575)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-11015, netSellCostBuyPrice = netSellCostBuyPrice-10575
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-10575
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-10575
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-10575
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-10575
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-10575
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-10575
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-10575;

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


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

COMMIT;
BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 14:15:49', '06ac8cc535102b', '1', '0.00', '0', '0', '1', '11015', '11015', '11015', '0', '1', '2026-10-09 14:15:49', '', '1', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '22', '324', 'sellbillController', '0','','','','','-1','0','0','11015','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-09','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=376
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','اضافة فاتورة مبيعات (معدله)','376', '0', '2026-10-09 20:52:05', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '11015', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-09 14:15:49','0','0','',''); -- id=499
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 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 ('535','01346', '376', '31', '1346', '6.00', '555', '3330', '0', '', '0', '2026-10-09 20:52:05', '1346', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','38-6,','1','1','0','0','555','3330','0','','0','0.00','0','0','0','0'); -- id=1366
UPDATE sellbilldetail SET  lastbuyprice = 535.00 , meanbuyprice = 535.00, lastbuyprice_withDiscount = 535.00, meanbuyprice_withDiscount = 535.00
        , lastbuyprice_withTax = 535, meanbuyprice_withTax = 535, lastbuyprice_withDiscountAndTax = 535
                where sellbilldetailid = 1366;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1346, '2026-10-09', 3330, 3210, 3210
                    , 3210, 3210, 3210, 3210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3210, 3210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3330, sellCostBuyPrice =sellCostBuyPrice+3210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3210
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3330, 3210, 3210
                    , 3210, 3210, 3210, 3210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3210, 3210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3330, sellCostBuyPrice =sellCostBuyPrice+3210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3210
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-10-09 20:52:05' WHERE storedetailid = '1346';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1346', '1', '6', '1', '376', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '18', '12', '1', '2026-10-09 20:52:05','0','0'); -- id=4427
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('365','09666', '376', '30', '976', '5.00', '385', '1925', '0', '', '0', '2026-10-09 20:52:05', '976', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','385','1925','0','','0','0.00','0','0','0','0'); -- id=1367
UPDATE sellbilldetail SET  lastbuyprice = 365.00 , meanbuyprice = 365.00, lastbuyprice_withDiscount = 365.00, meanbuyprice_withDiscount = 365.00
        , lastbuyprice_withTax = 365, meanbuyprice_withTax = 365, lastbuyprice_withDiscountAndTax = 365
                where sellbilldetailid = 1367;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (976, '2026-10-09', 1925, 1825, 1825
                    , 1825, 1825, 1825, 1825
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1825, 1825, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1925, sellCostBuyPrice =sellCostBuyPrice+1825
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1825, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1825
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1825, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1825
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1825
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1825
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1825
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 1925, 1825, 1825
                    , 1825, 1825, 1825, 1825
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1825, 1825, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1925, sellCostBuyPrice =sellCostBuyPrice+1825
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1825, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1825
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1825, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1825
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1825
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1825
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1825
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '105', userid = '1', storedetaildate = '2026-10-09 20:52:05' WHERE storedetailid = '976';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('976', '1', '5', '1', '376', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '110', '105', '1', '2026-10-09 20:52:05','0','0'); -- id=4428
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('490','09317', '376', '2', '1006', '6.00', '510', '3060', '0', '', '0', '2026-10-09 20:52:05', '1006', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','510','3060','0','','0','0.00','0','0','0','0'); -- id=1368
UPDATE sellbilldetail SET  lastbuyprice = 490.00 , meanbuyprice = 490.00, lastbuyprice_withDiscount = 490.00, meanbuyprice_withDiscount = 490.00
        , lastbuyprice_withTax = 490, meanbuyprice_withTax = 490, lastbuyprice_withDiscountAndTax = 490
                where sellbilldetailid = 1368;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1006, '2026-10-09', 3060, 2940, 2940
                    , 2940, 2940, 2940, 2940
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2940, 2940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3060, sellCostBuyPrice =sellCostBuyPrice+2940
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2940, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2940
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2940
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2940
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 3060, 2940, 2940
                    , 2940, 2940, 2940, 2940
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2940, 2940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3060, sellCostBuyPrice =sellCostBuyPrice+2940
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2940, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2940
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2940
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2940
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-10-09 20:52:05' WHERE storedetailid = '1006';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1006', '1', '6', '1', '376', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '25', '19', '1', '2026-10-09 20:52:05','0','0'); -- id=4429
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 65;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('520','01367', '376', '19', '1367', '5.00', '540', '2700', '0', '', '0', '2026-10-09 20:52:05', '1367', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','65-5,','1','1','0','0','540','2700','0','','0','0.00','0','0','0','0'); -- id=1369
UPDATE sellbilldetail SET  lastbuyprice = 520.00 , meanbuyprice = 520.00, lastbuyprice_withDiscount = 520.00, meanbuyprice_withDiscount = 520.00
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 520
                where sellbilldetailid = 1369;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1367, '2026-10-09', 2700, 2600, 2600
                    , 2600, 2600, 2600, 2600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2600, 2600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 2700, 2600, 2600
                    , 2600, 2600, 2600, 2600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2600, 2600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '62', userid = '1', storedetaildate = '2026-10-09 20:52:05' WHERE storedetailid = '1367';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1367', '1', '5', '1', '376', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '67', '62', '1', '2026-10-09 20:52:05','0','0'); -- id=4430
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '2113310',  userid = '1' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('2102295','11015', '0', '2', 'اضافة فاتورة مبيعات (معدله)', '376', '2113310', '2026-10-09 20:52:05', '1',  'sellbillController.php','1','','0'); -- id=433
UPDATE dailyentry SET totalcreditor = '10575.00', totaldebtor = '10575.00', thedate = '2026-10-09', userid = '2', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 14:15:49', entryComment = 'اضافة فاتورة مبيعات رقم 324 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='324',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=324' WHERE id = '1781';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10575.00', '10575.00', '2026-10-09', '1', '0', '1781', '2026-10-09 20:52:05','تم عكس القيد رقم 1781 ','1','0','-1','0','0',''); -- id=1925
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1925', '402', '10575.00', '','0'); -- id=1927
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3596586.33', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1925', '382', '10575.00', '','0'); -- id=1960
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20359602.87', 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 ( '11015', '11015', '2026-10-09', '1', '0', '0', '2026-10-09 20:52:05','اضافة فاتورة مبيعات رقم 376','1','0',null,'0','376','sellbillController.php?do=showDetail&sellbillid=376'); -- id=1926
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1926', '419', '11015', '','0'); -- id=1961
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '2113310', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1926', '143', '11015', '','0'); -- id=1928
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '3850160', 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 ( '10575', '10575', '2026-10-09', '1', '0', '0', '2026-10-09 20:52:05','اضافة فاتورة مبيعات رقم 376 - صرف البضاعة من المخزن','1','0',null,'0','376','sellbillController.php?do=showDetail&sellbillid=376'); -- id=1927
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1927', '402', '10575', '','0'); -- id=1962
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '3607161.33', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1927', '382', '10575', '','0'); -- id=1929
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '20349027.87', 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='1926,0,1927' where sellbillid=376;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-09', 11015, 10575, 10575
                    , 10575, 10575, 10575, 10575
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10575, 10575, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11015, sellCostBuyPrice =sellCostBuyPrice+10575
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10575, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10575
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10575, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10575
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10575
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10575
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10575
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-09', 11015, 10575, 10575
                    , 10575, 10575, 10575, 10575
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10575, 10575, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11015, sellCostBuyPrice =sellCostBuyPrice+10575
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10575, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10575
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10575, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10575
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10575
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10575
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10575
                        , returnSellVal = returnSellVal+0, 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, 11015, 10575, 10575
                    , 10575, 10575, 10575, 10575, 10575, 10575)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+11015, netSellCostBuyPrice = netSellCostBuyPrice+10575
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+10575
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+10575
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+10575
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+10575
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+10575
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+10575
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+10575;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 324 and newid=376 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:22:06";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:52:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-09 20:52:06', '1', 'editprint', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editprint&id=376'); -- id=6586
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:22:51";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:52:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:52:51', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6587
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:23:17";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:53:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:53:17', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6588
BEGIN;
CALL supplierInUse(78,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('78', '1171860.00', '50000', '1', 'ايصال دفع لمورد', '1', '1121860', '2026-10-09 20:52:51', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','50000','1','0','0','0','21',''); -- id=308
UPDATE supplierdebtchange SET supplierid = '78', supplierdebtchangebefore = '1171860.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '1121860', supplierdebtchangedate = '2026-10-09 20:52:51', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='1171860',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='1121860', paySerialNo='21',tagids='' WHERE supplierdebtchangeid = '308';
UPDATE supplier SET  suppliercurrentDebt = '1121860',suppliercurrentDebtInCurrency= '1121860' , userid = '1', supplierdate = '2026-10-09 20:53:17'   WHERE supplierid = '78';
UPDATE supplier SET  inUse = 0 where supplierid = 78;
UPDATE save SET  savecurrentvalue = '-2117750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2067750.00','50000', '1', '1', 'ايصال دفع لمورد', '308', '-2117750', '2026-10-09 20:53:17', '1',  'supplierPayedDeptController.php','0','','0'); -- id=434
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 20:53:17','ايصال دفع لمورد ( احمد الكاشف ) ','1','0','-1','0','308','supplierReportsController.php?do=show&id=308'); -- id=1928
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1928', '504', '50000', '','0'); -- id=1963
UPDATE accountstree SET name = 'احمد الكاشف', customName = 'احمد الكاشف', customNameEn = 'احمد الكاشف', nameEn = 'احمد الكاشف', parent = '81', accountNature = '1', theValue = '1121860', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 19:10:02' WHERE id = '504';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1928', '383', '50000', '','0'); -- id=1930
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2117750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '78', supplierdebtchangebefore = '1171860.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '1121860.00', supplierdebtchangedate = '2026-10-09 20:52:51', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '1928',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='1171860',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='1121860', paySerialNo='21',tagids='' WHERE supplierdebtchangeid = '308';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:23:17";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:53:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:53:17', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6589
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:23:18";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:53:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:53:18', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6590
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:23:19";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:53:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 20:53:19', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6591
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:23:21";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:53:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:53:21', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6592
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:23:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:53:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:53:34', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6593
BEGIN;
CALL supplierInUse(6,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('6', '1069642.00', '50000', '1', 'ايصال دفع لمورد', '1', '1019642', '2026-10-09 20:53:21', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','50000','1','0','0','0','22',''); -- id=309
UPDATE supplierdebtchange SET supplierid = '6', supplierdebtchangebefore = '1069642.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '1019642', supplierdebtchangedate = '2026-10-09 20:53:21', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='780135',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='1019642', paySerialNo='22',tagids='' WHERE supplierdebtchangeid = '309';
UPDATE supplier SET  suppliercurrentDebt = '1019642',suppliercurrentDebtInCurrency= '1019642' , userid = '1', supplierdate = '2026-10-09 20:53:34'   WHERE supplierid = '6';
UPDATE supplier SET  inUse = 0 where supplierid = 6;
UPDATE save SET  savecurrentvalue = '-2167750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2117750.00','50000', '1', '1', 'ايصال دفع لمورد', '309', '-2167750', '2026-10-09 20:53:34', '1',  'supplierPayedDeptController.php','0','','0'); -- id=435
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 20:53:34','ايصال دفع لمورد ( فيلو - مورد ) ','1','0','-1','0','309','supplierReportsController.php?do=show&id=309'); -- id=1929
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1929', '425', '50000', '','0'); -- id=1964
UPDATE accountstree SET name = 'فيلو - مورد', customName = 'فيلو - مورد', customNameEn = 'فيلو - مورد', nameEn = 'فيلو - مورد', parent = '81', accountNature = '1', theValue = '184105', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '425';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1929', '383', '50000', '','0'); -- id=1931
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2167750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '6', supplierdebtchangebefore = '1069642.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '1019642.00', supplierdebtchangedate = '2026-10-09 20:53:21', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '1929',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='780135',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='1019642', paySerialNo='22',tagids='' WHERE supplierdebtchangeid = '309';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:23:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:53:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:53:34', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6594
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:23:36";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:53:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:53:36', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6595
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:23:36";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:53:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 20:53:36', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6596
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:23:37";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:53:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:53:37', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6597
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:23:48";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:53:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:53:48', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6598
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:23:55";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:53:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:53:55', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php'); -- id=6599
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:24:11";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:54:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:54:11', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6600
BEGIN;
CALL supplierInUse(74,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('74', '730360.00', '50000', '1', 'ايصال دفع لمورد', '1', '680360', '2026-10-09 20:53:37', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','50000','1','0','0','0','23',''); -- id=310
UPDATE supplierdebtchange SET supplierid = '74', supplierdebtchangebefore = '730360.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '680360', supplierdebtchangedate = '2026-10-09 20:53:37', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='730360',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='680360', paySerialNo='23',tagids='' WHERE supplierdebtchangeid = '310';
UPDATE supplier SET  suppliercurrentDebt = '680360',suppliercurrentDebtInCurrency= '680360' , userid = '1', supplierdate = '2026-10-09 20:54:11'   WHERE supplierid = '74';
UPDATE supplier SET  inUse = 0 where supplierid = 74;
UPDATE save SET  savecurrentvalue = '-2217750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2167750.00','50000', '1', '1', 'ايصال دفع لمورد', '310', '-2217750', '2026-10-09 20:54:11', '1',  'supplierPayedDeptController.php','0','','0'); -- id=436
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 20:54:11','ايصال دفع لمورد ( محمد العوضي تريكو ) ','1','0','-1','0','310','supplierReportsController.php?do=show&id=310'); -- id=1930
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1930', '494', '50000', '','0'); -- id=1965
UPDATE accountstree SET name = 'محمد العوضي تريكو', customName = 'محمد العوضي تريكو', customNameEn = 'محمد العوضي تريكو', nameEn = 'محمد العوضي تريكو', parent = '81', accountNature = '1', theValue = '680360', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 10:33:20' WHERE id = '494';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1930', '383', '50000', '','0'); -- id=1932
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2217750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '74', supplierdebtchangebefore = '730360.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '680360.00', supplierdebtchangedate = '2026-10-09 20:53:37', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '1930',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='730360',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='680360', paySerialNo='23',tagids='' WHERE supplierdebtchangeid = '310';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:24:12";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:54:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:54:12', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6601
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:24:13";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:54:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:54:13', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6602
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:24:14";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:54:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 20:54:14', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6603
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:25:28";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:55:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 20:55:28', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6604
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:25:28";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 20:55:28', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6605
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:25:32";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:55:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:55:32', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php'); -- id=6606
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:25:42";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:55:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:55:42', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=6607
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:25:44";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:55:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:55:44', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6608
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:25:57";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:55:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:55:57', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6609
BEGIN;
CALL supplierInUse(50,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('50', '519410.00', '30000', '1', 'ايصال دفع لمورد', '1', '489410', '2026-10-09 20:55:44', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','30000','1','0','0','0','24',''); -- id=311
UPDATE supplierdebtchange SET supplierid = '50', supplierdebtchangebefore = '519410.00', supplierdebtchangeamount = '30000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '489410', supplierdebtchangedate = '2026-10-09 20:55:44', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='30000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='519410',debtchangamountInSupplierCurrency='30000',debtchangafterInSupplierCurrency='489410', paySerialNo='24',tagids='' WHERE supplierdebtchangeid = '311';
UPDATE supplier SET  suppliercurrentDebt = '489410',suppliercurrentDebtInCurrency= '489410' , userid = '1', supplierdate = '2026-10-09 20:55:57'   WHERE supplierid = '50';
UPDATE supplier SET  inUse = 0 where supplierid = 50;
UPDATE save SET  savecurrentvalue = '-2247750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2217750.00','30000', '1', '1', 'ايصال دفع لمورد', '311', '-2247750', '2026-10-09 20:55:57', '1',  'supplierPayedDeptController.php','0','','0'); -- id=437
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '30000', '30000', '2026-10-09', '1', '0', '0', '2026-10-09 20:55:57','ايصال دفع لمورد ( كافاني - مورد ) ','1','0','-1','0','311','supplierReportsController.php?do=show&id=311'); -- id=1931
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1931', '469', '30000', '','0'); -- id=1966
UPDATE accountstree SET name = 'كافاني - مورد', customName = 'كافاني - مورد', customNameEn = 'كافاني - مورد', nameEn = 'كافاني - مورد', parent = '81', accountNature = '1', theValue = '13960', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '469';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1931', '383', '30000', '','0'); -- id=1933
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2247750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '50', supplierdebtchangebefore = '519410.00', supplierdebtchangeamount = '30000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '489410.00', supplierdebtchangedate = '2026-10-09 20:55:44', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '1931',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='30000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='519410',debtchangamountInSupplierCurrency='30000',debtchangafterInSupplierCurrency='489410', paySerialNo='24',tagids='' WHERE supplierdebtchangeid = '311';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:25:57";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:55:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:55:57', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6610
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:25:59";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:55:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 20:55:59', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6611
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:25:59";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:55:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 20:55:59', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6612
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:27:27";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:57:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:57:27', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php'); -- id=6613
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:27:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:57:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:57:34', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=6614
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:27:58";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:57:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:57:58', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=add'); -- id=6615

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =500
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(22,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '432377' , clientdate = '2026-10-09 20:57:58', userid = '1' WHERE clientid = '22';
UPDATE client SET  inUse = 0 where clientid = 22;
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 ('22','482377.00','50000','1','ايصال تحصيل (( قبض من عميل ))','500', '432377', '2026-09-20  19:30:55', '1', 'clientPayedDeptController.php', '   ', '50000', '0', null, '0', null, null,'', '-1','1','1','50000','1','','482','0','','.'); -- id=500
UPDATE save SET  savecurrentvalue = '-2197750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2247750.00','50000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '500', '-2197750', '2026-10-09 20:57:58', '1',  'clientPayedDeptController.php','22','','0'); -- id=438
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 20:57:58','اضافة ايصال سداد للعميل طه رفاعي - العملاء','1','0','0','0','500','clientPayedDeptController.php?do=show&id=500'); -- id=1932
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1932', '383', '50000', '','0'); -- id=1967
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2197750', 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 ('1932', '520', '50000', '','0'); -- id=1934
UPDATE accountstree SET name = 'طه رفاعي - العملاء', customName = 'طه رفاعي - العملاء', customNameEn = 'طه رفاعي - العملاء', nameEn = 'طه رفاعي - العملاء', parent = '58', accountNature = '0', theValue = '-50000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '520';
UPDATE clientdebtchange SET clientid = '22', clientdebtchangebefore = '482377.000', clientdebtchangeamount = '50000.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '500', clientdebtchangeafter = '432377.000', clientdebtchangedate = '2026-09-20 19:30:55', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '50000.000',discount='', reciptid='0', dailyentryid = '1932',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '500';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:27:58";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:57:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:57:58', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=6616
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:27:59";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:57:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:57:59', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=show'); -- id=6617
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:28:03";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:58:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:58:03', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php'); -- id=6618
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:28:37";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:58:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:58:37', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=add'); -- id=6619

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =501
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(22,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '382377' , clientdate = '2026-10-09 20:58:37', userid = '1' WHERE clientid = '22';
UPDATE client SET  inUse = 0 where clientid = 22;
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 ('22','432377.00','50000','1','ايصال تحصيل (( قبض من عميل ))','501', '382377', '2026-09-26  14:55:3', '1', 'clientPayedDeptController.php', '   ', '50000', '0', null, '0', null, null,'', '-1','1','1','50000','1','','483','0','','.'); -- id=501
UPDATE save SET  savecurrentvalue = '-2147750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2197750.00','50000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '501', '-2147750', '2026-10-09 20:58:37', '1',  'clientPayedDeptController.php','22','','0'); -- id=439
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 20:58:37','اضافة ايصال سداد للعميل طه رفاعي - العملاء','1','0','0','0','501','clientPayedDeptController.php?do=show&id=501'); -- id=1933
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1933', '383', '50000', '','0'); -- id=1968
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2147750', 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 ('1933', '520', '50000', '','0'); -- id=1935
UPDATE accountstree SET name = 'طه رفاعي - العملاء', customName = 'طه رفاعي - العملاء', customNameEn = 'طه رفاعي - العملاء', nameEn = 'طه رفاعي - العملاء', parent = '58', accountNature = '0', theValue = '-100000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '520';
UPDATE clientdebtchange SET clientid = '22', clientdebtchangebefore = '432377.000', clientdebtchangeamount = '50000.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '501', clientdebtchangeafter = '382377.000', clientdebtchangedate = '2026-09-26 14:55:03', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '50000.000',discount='', reciptid='0', dailyentryid = '1933',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '501';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:28:37";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:58:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:58:37', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=6620
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:28:39";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:58:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 20:58:39', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=show'); -- id=6621
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:28:41";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:58:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:58:41', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=6622
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:28:51";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:58:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 20:58:51', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php'); -- id=6623
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:28:52";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:58:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 20:58:52', '1', 'showallajax', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php?do=showallajax'); -- id=6624
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:28:54";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:58:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:58:54', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=6625
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:28:54";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:58:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientController.php', '2026-10-09 20:58:54', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientController.php?do=show'); -- id=6626
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:29:09";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:59:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsnewController.php', '2026-10-09 20:59:09', '1', 'clientShowbure', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsnewController.php?do=clientShowbure'); -- id=6627
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:29:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:59:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:59:34', '1', 'all', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=all'); -- id=6628
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:29:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:59:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsnewController.php', '2026-10-09 20:59:34', '1', 'clientShowbure', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsnewController.php?do=clientShowbure'); -- id=6629
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:29:42";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:59:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:59:42', '1', 'all', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=all'); -- id=6630
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:29:54";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 20:59:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 20:59:54', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php'); -- id=6631
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:30:06";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:00:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientsAndProductsReportController.php', '2026-10-09 21:00:06', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientsAndProductsReportController.php'); -- id=6632
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:30:17";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:00:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientsAndProductsReportController.php', '2026-10-09 21:00:17', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientsAndProductsReportController.php'); -- id=6633
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:30:24";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:00:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientsAndProductsReportController.php', '2026-10-09 21:00:24', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientsAndProductsReportController.php?do=show'); -- id=6634
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:30:27";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:00:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 21:00:27', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php'); -- id=6635
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:30:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:00:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientsAndProductsReportController.php', '2026-10-09 21:00:34', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientsAndProductsReportController.php?do=show'); -- id=6636
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:30:40";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:00:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsnewController.php', '2026-10-09 21:00:40', '1', 'clientShowbure', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsnewController.php?do=clientShowbure'); -- id=6637
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:30:46";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:00:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsnewController.php', '2026-10-09 21:00:46', '1', 'clientShowbure', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsnewController.php?do=clientShowbure'); -- id=6638
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:30:51";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:00:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsnewController.php', '2026-10-09 21:00:51', '1', 'clientShowbure', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsnewController.php?do=clientShowbure'); -- id=6639
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:30:59";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:00:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsnewController.php', '2026-10-09 21:00:59', '1', 'clientShowbure', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsnewController.php?do=clientShowbure'); -- id=6640
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:31:37";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:01:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsnewController.php', '2026-10-09 21:01:37', '1', 'clientShowbure', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsnewController.php?do=clientShowbure'); -- id=6641
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:31:43";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:01:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsnewController.php', '2026-10-09 21:01:43', '1', 'clientShowbure', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsnewController.php?do=clientShowbure'); -- id=6642
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:34:23";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:04:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:04:23', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6643
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:35:22";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:05:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:05:22', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php'); -- id=6644
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:36:06";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:06:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:06:06', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6645
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:36:08";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:06:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:06:08', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php'); -- id=6646
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:37:11";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:07:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:07:11', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6647
BEGIN;
CALL supplierInUse(75,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('75', '237090.00', '300000', '1', 'ايصال دفع لمورد', '1', '-62910', '2026-10-09 21:04:23', '1', 'supplierPayedDeptController.php', 'دفعة استفاح 
100 نقدي
200 شيك 28-11', '0','1', '-1','1','1','300000','1','0','0','0','25',''); -- id=312
UPDATE supplierdebtchange SET supplierid = '75', supplierdebtchangebefore = '237090.00', supplierdebtchangeamount = '300000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-62910', supplierdebtchangedate = '2026-10-09 21:04:23', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح 
100 نقدي
200 شيك 28-11', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='300000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='237090',debtchangamountInSupplierCurrency='300000',debtchangafterInSupplierCurrency='-62910', paySerialNo='25',tagids='' WHERE supplierdebtchangeid = '312';
UPDATE supplier SET  suppliercurrentDebt = '-62910',suppliercurrentDebtInCurrency= '-62910' , userid = '1', supplierdate = '2026-10-09 21:07:11'   WHERE supplierid = '75';
UPDATE supplier SET  inUse = 0 where supplierid = 75;
UPDATE save SET  savecurrentvalue = '-2447750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2147750.00','300000', '1', '1', 'ايصال دفع لمورد', '312', '-2447750', '2026-10-09 21:07:11', '1',  'supplierPayedDeptController.php','0','','0'); -- id=440
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '300000', '300000', '2026-10-09', '1', '0', '0', '2026-10-09 21:07:11','ايصال دفع لمورد ( سفنتي ) ','1','0','-1','0','312','supplierReportsController.php?do=show&id=312'); -- id=1934
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1934', '499', '300000', '','0'); -- id=1969
UPDATE accountstree SET name = 'سفنتي', customName = 'سفنتي', customNameEn = 'سفنتي', nameEn = 'سفنتي', parent = '81', accountNature = '1', theValue = '-62910', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 16:43:09' WHERE id = '499';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1934', '383', '300000', '','0'); -- id=1936
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2447750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '75', supplierdebtchangebefore = '237090.00', supplierdebtchangeamount = '300000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-62910.00', supplierdebtchangedate = '2026-10-09 21:04:23', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح 
100 نقدي
200 شيك 28-11', dailyentryid = '1934',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='300000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='237090',debtchangamountInSupplierCurrency='300000',debtchangafterInSupplierCurrency='-62910', paySerialNo='25',tagids='' WHERE supplierdebtchangeid = '312';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:37:11";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:07:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:07:11', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6648
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:37:13";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:07:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:07:13', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6649
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:37:13";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:07:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:07:13', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6650
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:37:41";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:07:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:07:41', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6651
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:38:39";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:08:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:08:39', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6652
BEGIN;
CALL supplierInUse(80,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('80', '119000.00', '50000', '1', 'ايصال دفع لمورد', '1', '69000', '2026-10-09 21:07:42', '1', 'supplierPayedDeptController.php', 'دفعه نقدي استفاح', '0','1', '-1','1','1','50000','1','0','0','0','26',''); -- id=313
UPDATE supplierdebtchange SET supplierid = '80', supplierdebtchangebefore = '119000.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '69000', supplierdebtchangedate = '2026-10-09 21:07:42', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعه نقدي استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='119000',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='69000', paySerialNo='26',tagids='' WHERE supplierdebtchangeid = '313';
UPDATE supplier SET  suppliercurrentDebt = '69000',suppliercurrentDebtInCurrency= '69000' , userid = '1', supplierdate = '2026-10-09 21:08:39'   WHERE supplierid = '80';
UPDATE supplier SET  inUse = 0 where supplierid = 80;
UPDATE save SET  savecurrentvalue = '-2497750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2447750.00','50000', '1', '1', 'ايصال دفع لمورد', '313', '-2497750', '2026-10-09 21:08:39', '1',  'supplierPayedDeptController.php','0','','0'); -- id=441
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 21:08:39','ايصال دفع لمورد ( محمد تريكو ) ','1','0','-1','0','313','supplierReportsController.php?do=show&id=313'); -- id=1935
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1935', '557', '50000', '','0'); -- id=1970
UPDATE accountstree SET name = 'محمد تريكو', customName = 'محمد تريكو', customNameEn = 'محمد تريكو', nameEn = 'محمد تريكو', parent = '81', accountNature = '1', theValue = '69000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-02 17:22:07' WHERE id = '557';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1935', '383', '50000', '','0'); -- id=1937
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2497750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '80', supplierdebtchangebefore = '119000.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '69000.00', supplierdebtchangedate = '2026-10-09 21:07:42', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعه نقدي استفاح', dailyentryid = '1935',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='119000',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='69000', paySerialNo='26',tagids='' WHERE supplierdebtchangeid = '313';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:38:39";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:08:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:08:39', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6653
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:38:40";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:08:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:08:40', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6654
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:38:41";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:08:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:08:41', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6655
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:38:42";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:08:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:08:42', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6656
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:39:00";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:09:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:09:00', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6657
BEGIN;
CALL supplierInUse(81,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('81', '258900.00', '50000', '1', 'ايصال دفع لمورد', '1', '208900', '2026-10-09 21:08:42', '1', 'supplierPayedDeptController.php', 'دفعة استفاح نقدي', '0','1', '-1','1','1','50000','1','0','0','0','27',''); -- id=314
UPDATE supplierdebtchange SET supplierid = '81', supplierdebtchangebefore = '258900.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '208900', supplierdebtchangedate = '2026-10-09 21:08:42', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح نقدي', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='258900',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='208900', paySerialNo='27',tagids='' WHERE supplierdebtchangeid = '314';
UPDATE supplier SET  suppliercurrentDebt = '208900',suppliercurrentDebtInCurrency= '208900' , userid = '1', supplierdate = '2026-10-09 21:09:01'   WHERE supplierid = '81';
UPDATE supplier SET  inUse = 0 where supplierid = 81;
UPDATE save SET  savecurrentvalue = '-2547750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2497750.00','50000', '1', '1', 'ايصال دفع لمورد', '314', '-2547750', '2026-10-09 21:09:01', '1',  'supplierPayedDeptController.php','0','','0'); -- id=442
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 21:09:01','ايصال دفع لمورد ( الجنتل ) ','1','0','-1','0','314','supplierReportsController.php?do=show&id=314'); -- id=1936
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1936', '558', '50000', '','0'); -- id=1971
UPDATE accountstree SET name = 'الجنتل', customName = 'الجنتل', customNameEn = 'الجنتل', nameEn = 'الجنتل', parent = '81', accountNature = '1', theValue = '208900', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-02 17:23:38' WHERE id = '558';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1936', '383', '50000', '','0'); -- id=1938
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2547750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '81', supplierdebtchangebefore = '258900.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '208900.00', supplierdebtchangedate = '2026-10-09 21:08:42', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح نقدي', dailyentryid = '1936',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='258900',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='208900', paySerialNo='27',tagids='' WHERE supplierdebtchangeid = '314';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:39:01";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:09:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:09:01', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6658
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:39:02";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:09:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:09:02', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6659
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:39:03";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:09:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:09:03', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6660
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:39:08";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:09:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:09:08', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6661
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:39:26";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:09:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:09:26', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6662
BEGIN;
CALL supplierInUse(108,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('108', '214650.00', '50000', '1', 'ايصال دفع لمورد', '1', '164650', '2026-10-09 21:09:08', '1', 'supplierPayedDeptController.php', 'دفعة استفاح نقدي', '0','1', '-1','1','1','50000','1','0','0','0','28',''); -- id=315
UPDATE supplierdebtchange SET supplierid = '108', supplierdebtchangebefore = '214650.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '164650', supplierdebtchangedate = '2026-10-09 21:09:08', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح نقدي', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='214650',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='164650', paySerialNo='28',tagids='' WHERE supplierdebtchangeid = '315';
UPDATE supplier SET  suppliercurrentDebt = '164650',suppliercurrentDebtInCurrency= '164650' , userid = '1', supplierdate = '2026-10-09 21:09:26'   WHERE supplierid = '108';
UPDATE supplier SET  inUse = 0 where supplierid = 108;
UPDATE save SET  savecurrentvalue = '-2597750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2547750.00','50000', '1', '1', 'ايصال دفع لمورد', '315', '-2597750', '2026-10-09 21:09:26', '1',  'supplierPayedDeptController.php','0','','0'); -- id=443
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 21:09:26','ايصال دفع لمورد ( ريفال تريكو ) ','1','0','-1','0','315','supplierReportsController.php?do=show&id=315'); -- id=1937
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1937', '591', '50000', '','0'); -- id=1972
UPDATE accountstree SET name = 'ريفال تريكو', customName = 'ريفال تريكو', customNameEn = 'ريفال تريكو', nameEn = 'ريفال تريكو', parent = '81', accountNature = '1', theValue = '164650', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-07 12:12:44' WHERE id = '591';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1937', '383', '50000', '','0'); -- id=1939
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2597750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '108', supplierdebtchangebefore = '214650.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '164650.00', supplierdebtchangedate = '2026-10-09 21:09:08', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح نقدي', dailyentryid = '1937',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='214650',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='164650', paySerialNo='28',tagids='' WHERE supplierdebtchangeid = '315';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:39:26";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:09:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:09:26', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6663
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:39:28";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:09:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:09:28', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6664
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:39:28";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:09:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:09:28', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6665
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:39:29";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:09:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:09:29', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6666
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:39:45";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:09:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:09:45', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6667
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:39:52";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:09:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:09:52', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=add'); -- id=6668
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('برو', '', '', '0', '', '0', '1', '2026-10-09 21:09:52', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=137
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 ('137', '0', '0', '0', 'إضافة مورد جديد', '137', '0', '2026-10-09 21:09:52', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=316
UPDATE client SET clientname = '', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '', clientdetails = '', conditions = null, clientdate = '', userid = null  , clientareaid = null  ,clientcode = '',dailyentryid = null , rondomtxt = '',clientStoreIds = '', obygyPatientId = '0' , debtLimit='0' , typeclientid='',priceTypeId='0',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '137',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='0',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='0',datecustomeraccount='',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='' WHERE clientid = null;
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('برو', 'برو', 'برو', 'برو', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 21:09:52'); -- id=620
UPDATE supplier SET suppliername = 'برو', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='620',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '137';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:39:52";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:09:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:09:52', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=sucess'); -- id=6669
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:39:53";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:09:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:09:53', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php'); -- id=6670
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:39:58";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:09:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:09:58', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6671
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:40:19";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:10:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:10:19', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6672
BEGIN;
CALL supplierInUse(137,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('137', '0.00', '100000', '1', 'ايصال دفع لمورد', '1', '-100000', '2026-10-09 21:09:58', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','100000','1','0','0','0','29',''); -- id=317
UPDATE supplierdebtchange SET supplierid = '137', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '100000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-100000', supplierdebtchangedate = '2026-10-09 21:09:58', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='-100000', paySerialNo='29',tagids='' WHERE supplierdebtchangeid = '317';
UPDATE supplier SET  suppliercurrentDebt = '-100000',suppliercurrentDebtInCurrency= '-100000' , userid = '1', supplierdate = '2026-10-09 21:10:19'   WHERE supplierid = '137';
UPDATE supplier SET  inUse = 0 where supplierid = 137;
UPDATE save SET  savecurrentvalue = '-2697750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2597750.00','100000', '1', '1', 'ايصال دفع لمورد', '317', '-2697750', '2026-10-09 21:10:19', '1',  'supplierPayedDeptController.php','0','','0'); -- id=444
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '100000', '100000', '2026-10-09', '1', '0', '0', '2026-10-09 21:10:19','ايصال دفع لمورد ( برو ) ','1','0','-1','0','317','supplierReportsController.php?do=show&id=317'); -- id=1938
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1938', '620', '100000', '','0'); -- id=1973
UPDATE accountstree SET name = 'برو', customName = 'برو', customNameEn = 'برو', nameEn = 'برو', parent = '81', accountNature = '1', theValue = '-100000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:09:52' WHERE id = '620';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1938', '383', '100000', '','0'); -- id=1940
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2697750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '137', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '100000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-100000.00', supplierdebtchangedate = '2026-10-09 21:09:58', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1938',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='-100000', paySerialNo='29',tagids='' WHERE supplierdebtchangeid = '317';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:40:19";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:10:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:10:19', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6673
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:40:21";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:10:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:10:21', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6674
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:40:21";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:10:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:10:21', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6675
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:40:22";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:10:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:10:22', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6676
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:40:29";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:10:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:10:29', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6677
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:40:45";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:10:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:10:45', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=add'); -- id=6678
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('زد و هارلي', '', '', '0', '', '0', '1', '2026-10-09 21:10:45', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=138
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 ('138', '0', '0', '0', 'إضافة مورد جديد', '138', '0', '2026-10-09 21:10:45', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=318
UPDATE client SET clientname = '', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '', clientdetails = '', conditions = null, clientdate = '', userid = null  , clientareaid = null  ,clientcode = '',dailyentryid = null , rondomtxt = '',clientStoreIds = '', obygyPatientId = '0' , debtLimit='0' , typeclientid='',priceTypeId='0',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '138',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='0',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='0',datecustomeraccount='',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='' WHERE clientid = null;
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('زد و هارلي', 'زد و هارلي', 'زد و هارلي', 'زد و هارلي', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 21:10:45'); -- id=621
UPDATE supplier SET suppliername = 'زد و هارلي', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='621',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '138';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:40:46";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:10:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:10:46', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=sucess'); -- id=6679
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:40:47";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:10:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:10:47', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=show'); -- id=6680
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:40:47";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:10:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:10:47', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6681
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:41:02";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:11:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:11:02', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6682
BEGIN;
CALL supplierInUse(138,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('138', '0.00', '100000', '1', 'ايصال دفع لمورد', '1', '-100000', '2026-10-09 21:10:48', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','100000','1','0','0','0','30',''); -- id=319
UPDATE supplierdebtchange SET supplierid = '138', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '100000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-100000', supplierdebtchangedate = '2026-10-09 21:10:48', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='-100000', paySerialNo='30',tagids='' WHERE supplierdebtchangeid = '319';
UPDATE supplier SET  suppliercurrentDebt = '-100000',suppliercurrentDebtInCurrency= '-100000' , userid = '1', supplierdate = '2026-10-09 21:11:02'   WHERE supplierid = '138';
UPDATE supplier SET  inUse = 0 where supplierid = 138;
UPDATE save SET  savecurrentvalue = '-2797750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2697750.00','100000', '1', '1', 'ايصال دفع لمورد', '319', '-2797750', '2026-10-09 21:11:02', '1',  'supplierPayedDeptController.php','0','','0'); -- id=445
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '100000', '100000', '2026-10-09', '1', '0', '0', '2026-10-09 21:11:02','ايصال دفع لمورد ( زد و هارلي ) ','1','0','-1','0','319','supplierReportsController.php?do=show&id=319'); -- id=1939
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1939', '621', '100000', '','0'); -- id=1974
UPDATE accountstree SET name = 'زد و هارلي', customName = 'زد و هارلي', customNameEn = 'زد و هارلي', nameEn = 'زد و هارلي', parent = '81', accountNature = '1', theValue = '-100000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:10:45' WHERE id = '621';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1939', '383', '100000', '','0'); -- id=1941
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2797750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '138', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '100000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-100000.00', supplierdebtchangedate = '2026-10-09 21:10:48', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '1939',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='-100000', paySerialNo='30',tagids='' WHERE supplierdebtchangeid = '319';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:41:03";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:11:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:11:03', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6683
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:41:04";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:11:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:11:04', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6684
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:41:04";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:11:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:11:05', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6685
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:41:06";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:11:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:11:06', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6686
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:41:35";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:11:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:11:35', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6687
BEGIN;
CALL supplierInUse(76,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('76', '280800.00', '100000', '1', 'ايصال دفع لمورد', '1', '180800', '2026-10-09 21:11:06', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','100000','1','0','0','0','31',''); -- id=320
UPDATE supplierdebtchange SET supplierid = '76', supplierdebtchangebefore = '280800.00', supplierdebtchangeamount = '100000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '180800', supplierdebtchangedate = '2026-10-09 21:11:06', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='280800',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='180800', paySerialNo='31',tagids='' WHERE supplierdebtchangeid = '320';
UPDATE supplier SET  suppliercurrentDebt = '180800',suppliercurrentDebtInCurrency= '180800' , userid = '1', supplierdate = '2026-10-09 21:11:35'   WHERE supplierid = '76';
UPDATE supplier SET  inUse = 0 where supplierid = 76;
UPDATE save SET  savecurrentvalue = '-2897750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2797750.00','100000', '1', '1', 'ايصال دفع لمورد', '320', '-2897750', '2026-10-09 21:11:35', '1',  'supplierPayedDeptController.php','0','','0'); -- id=446
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '100000', '100000', '2026-10-09', '1', '0', '0', '2026-10-09 21:11:35','ايصال دفع لمورد ( عبد العال ) ','1','0','-1','0','320','supplierReportsController.php?do=show&id=320'); -- id=1940
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1940', '502', '100000', '','0'); -- id=1975
UPDATE accountstree SET name = 'عبد العال', customName = 'عبد العال', customNameEn = 'عبد العال', nameEn = 'عبد العال', parent = '81', accountNature = '1', theValue = '180800', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 16:39:09' WHERE id = '502';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1940', '383', '100000', '','0'); -- id=1942
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2897750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '76', supplierdebtchangebefore = '280800.00', supplierdebtchangeamount = '100000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '180800.00', supplierdebtchangedate = '2026-10-09 21:11:06', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1940',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='280800',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='180800', paySerialNo='31',tagids='' WHERE supplierdebtchangeid = '320';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:41:35";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:11:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:11:35', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6688
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:41:37";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:11:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:11:37', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6689
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:41:37";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:11:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:11:37', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6690
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:41:45";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:11:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:11:45', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6691
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:42:07";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:12:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:12:07', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6692
BEGIN;
CALL supplierInUse(74,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('74', '680360.00', '150000', '1', 'ايصال دفع لمورد', '1', '530360', '2026-10-09 21:11:45', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','150000','1','0','0','0','32',''); -- id=321
UPDATE supplierdebtchange SET supplierid = '74', supplierdebtchangebefore = '680360.00', supplierdebtchangeamount = '150000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '530360', supplierdebtchangedate = '2026-10-09 21:11:45', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='150000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='680360',debtchangamountInSupplierCurrency='150000',debtchangafterInSupplierCurrency='530360', paySerialNo='32',tagids='' WHERE supplierdebtchangeid = '321';
UPDATE supplier SET  suppliercurrentDebt = '530360',suppliercurrentDebtInCurrency= '530360' , userid = '1', supplierdate = '2026-10-09 21:12:07'   WHERE supplierid = '74';
UPDATE supplier SET  inUse = 0 where supplierid = 74;
UPDATE save SET  savecurrentvalue = '-3047750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-2897750.00','150000', '1', '1', 'ايصال دفع لمورد', '321', '-3047750', '2026-10-09 21:12:07', '1',  'supplierPayedDeptController.php','0','','0'); -- id=447
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '150000', '150000', '2026-10-09', '1', '0', '0', '2026-10-09 21:12:07','ايصال دفع لمورد ( محمد العوضي تريكو ) ','1','0','-1','0','321','supplierReportsController.php?do=show&id=321'); -- id=1941
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1941', '494', '150000', '','0'); -- id=1976
UPDATE accountstree SET name = 'محمد العوضي تريكو', customName = 'محمد العوضي تريكو', customNameEn = 'محمد العوضي تريكو', nameEn = 'محمد العوضي تريكو', parent = '81', accountNature = '1', theValue = '530360', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 10:33:20' WHERE id = '494';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1941', '383', '150000', '','0'); -- id=1943
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-3047750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '74', supplierdebtchangebefore = '680360.00', supplierdebtchangeamount = '150000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '530360.00', supplierdebtchangedate = '2026-10-09 21:11:45', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1941',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='150000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='680360',debtchangamountInSupplierCurrency='150000',debtchangafterInSupplierCurrency='530360', paySerialNo='32',tagids='' WHERE supplierdebtchangeid = '321';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:42:07";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:12:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:12:07', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6693
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:42:09";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:12:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:12:09', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6694
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:42:09";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:12:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:12:09', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6695
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:42:10";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:12:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:12:10', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6696
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:42:26";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:12:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:12:26', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6697
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:42:38";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:12:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:12:38', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=add'); -- id=6698
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('الشايب', '', '', '0', '', '0', '1', '2026-10-09 21:12:38', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=139
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 ('139', '0', '0', '0', 'إضافة مورد جديد', '139', '0', '2026-10-09 21:12:38', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=322
UPDATE client SET clientname = '', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '', clientdetails = '', conditions = null, clientdate = '', userid = null  , clientareaid = null  ,clientcode = '',dailyentryid = null , rondomtxt = '',clientStoreIds = '', obygyPatientId = '0' , debtLimit='0' , typeclientid='',priceTypeId='0',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '139',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='0',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='0',datecustomeraccount='',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='' WHERE clientid = null;
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('الشايب', 'الشايب', 'الشايب', 'الشايب', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 21:12:38'); -- id=622
UPDATE supplier SET suppliername = 'الشايب', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='622',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '139';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:42:38";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:12:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:12:38', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=sucess'); -- id=6699
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:42:40";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:12:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:12:40', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=show'); -- id=6700
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:42:45";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:12:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:12:45', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6701
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:43:27";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:13:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:13:27', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6702
BEGIN;
CALL supplierInUse(139,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('139', '0.00', '1100000', '1', 'ايصال دفع لمورد', '1', '-1100000', '2026-10-09 21:12:45', '1', 'supplierPayedDeptController.php', 'دفعة 100 نقدي استفاح
عدد 5 شيكات
من شهر 11 حتي 3', '0','1', '-1','1','1','1100000','1','0','0','0','33',''); -- id=323
UPDATE supplierdebtchange SET supplierid = '139', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '1100000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-1100000', supplierdebtchangedate = '2026-10-09 21:12:45', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة 100 نقدي استفاح
عدد 5 شيكات
من شهر 11 حتي 3', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='1100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='1100000',debtchangafterInSupplierCurrency='-1100000', paySerialNo='33',tagids='' WHERE supplierdebtchangeid = '323';
UPDATE supplier SET  suppliercurrentDebt = '-1100000',suppliercurrentDebtInCurrency= '-1100000' , userid = '1', supplierdate = '2026-10-09 21:13:27'   WHERE supplierid = '139';
UPDATE supplier SET  inUse = 0 where supplierid = 139;
UPDATE save SET  savecurrentvalue = '-4147750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-3047750.00','1100000', '1', '1', 'ايصال دفع لمورد', '323', '-4147750', '2026-10-09 21:13:27', '1',  'supplierPayedDeptController.php','0','','0'); -- id=448
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1100000', '1100000', '2026-10-09', '1', '0', '0', '2026-10-09 21:13:27','ايصال دفع لمورد ( الشايب ) ','1','0','-1','0','323','supplierReportsController.php?do=show&id=323'); -- id=1942
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1942', '622', '1100000', '','0'); -- id=1977
UPDATE accountstree SET name = 'الشايب', customName = 'الشايب', customNameEn = 'الشايب', nameEn = 'الشايب', parent = '81', accountNature = '1', theValue = '-1100000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:12:38' WHERE id = '622';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1942', '383', '1100000', '','0'); -- id=1944
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-4147750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '139', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '1100000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-1100000.00', supplierdebtchangedate = '2026-10-09 21:12:45', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة 100 نقدي استفاح
عدد 5 شيكات
من شهر 11 حتي 3', dailyentryid = '1942',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='1100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='1100000',debtchangafterInSupplierCurrency='-1100000', paySerialNo='33',tagids='' WHERE supplierdebtchangeid = '323';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:43:28";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:13:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:13:28', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6703
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:43:30";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:13:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:13:30', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6704
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:43:31";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:13:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:13:31', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6705
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:43:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:13:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:13:34', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6706
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:44:42";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:14:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:14:42', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6707
BEGIN;
CALL supplierInUse(79,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('79', '403974.00', '100000', '1', 'ايصال دفع لمورد', '1', '303974', '2026-10-09 21:13:34', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','100000','1','0','0','0','34',''); -- id=324
UPDATE supplierdebtchange SET supplierid = '79', supplierdebtchangebefore = '403974.00', supplierdebtchangeamount = '100000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '303974', supplierdebtchangedate = '2026-10-09 21:13:34', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='403974',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='303974', paySerialNo='34',tagids='' WHERE supplierdebtchangeid = '324';
UPDATE supplier SET  suppliercurrentDebt = '303974',suppliercurrentDebtInCurrency= '303974' , userid = '1', supplierdate = '2026-10-09 21:14:42'   WHERE supplierid = '79';
UPDATE supplier SET  inUse = 0 where supplierid = 79;
UPDATE save SET  savecurrentvalue = '-4247750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-4147750.00','100000', '1', '1', 'ايصال دفع لمورد', '324', '-4247750', '2026-10-09 21:14:42', '1',  'supplierPayedDeptController.php','0','','0'); -- id=449
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '100000', '100000', '2026-10-09', '1', '0', '0', '2026-10-09 21:14:42','ايصال دفع لمورد ( فرنكو ) ','1','0','-1','0','324','supplierReportsController.php?do=show&id=324'); -- id=1943
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1943', '505', '100000', '','0'); -- id=1978
UPDATE accountstree SET name = 'فرنكو', customName = 'فرنكو', customNameEn = 'فرنكو', nameEn = 'فرنكو', parent = '81', accountNature = '1', theValue = '303974', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 20:20:28' WHERE id = '505';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1943', '383', '100000', '','0'); -- id=1945
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-4247750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '79', supplierdebtchangebefore = '403974.00', supplierdebtchangeamount = '100000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '303974.00', supplierdebtchangedate = '2026-10-09 21:13:34', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1943',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='403974',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='303974', paySerialNo='34',tagids='' WHERE supplierdebtchangeid = '324';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:44:42";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:14:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:14:42', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6708
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:44:44";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:14:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:14:44', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6709
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:44:44";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:14:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:14:44', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6710
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:44:44";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:14:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:14:44', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6711
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:44:58";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:14:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:14:58', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6712
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:45:07";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:15:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:15:07', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=add'); -- id=6713
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('الافريقي', '', '', '0', '', '0', '1', '2026-10-09 21:15:07', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=140
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 ('140', '0', '0', '0', 'إضافة مورد جديد', '140', '0', '2026-10-09 21:15:07', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=325
UPDATE client SET clientname = '', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '', clientdetails = '', conditions = null, clientdate = '', userid = null  , clientareaid = null  ,clientcode = '',dailyentryid = null , rondomtxt = '',clientStoreIds = '', obygyPatientId = '0' , debtLimit='0' , typeclientid='',priceTypeId='0',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '140',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='0',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='0',datecustomeraccount='',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='' WHERE clientid = null;
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('الافريقي', 'الافريقي', 'الافريقي', 'الافريقي', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 21:15:07'); -- id=623
UPDATE supplier SET suppliername = 'الافريقي', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='623',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '140';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:45:08";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:15:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:15:08', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=sucess'); -- id=6714
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:45:10";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:15:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:15:10', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=show'); -- id=6715
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:45:20";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:15:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:15:20', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6716
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:45:57";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:15:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:15:57', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6717
BEGIN;
CALL supplierInUse(79,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('79', '303974.00', '1000000', '1', 'ايصال دفع لمورد', '1', '-696026', '2026-10-09 21:15:20', '1', 'supplierPayedDeptController.php', 'عدد 5 شيكات * 200 
من شهر 11 حتي 3', '0','1', '-1','1','1','1000000','1','0','0','0','35',''); -- id=326
UPDATE supplierdebtchange SET supplierid = '79', supplierdebtchangebefore = '303974.00', supplierdebtchangeamount = '1000000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-696026', supplierdebtchangedate = '2026-10-09 21:15:20', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'عدد 5 شيكات * 200 
من شهر 11 حتي 3', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='1000000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='303974',debtchangamountInSupplierCurrency='1000000',debtchangafterInSupplierCurrency='-696026', paySerialNo='35',tagids='' WHERE supplierdebtchangeid = '326';
UPDATE supplier SET  suppliercurrentDebt = '-696026',suppliercurrentDebtInCurrency= '-696026' , userid = '1', supplierdate = '2026-10-09 21:15:57'   WHERE supplierid = '79';
UPDATE supplier SET  inUse = 0 where supplierid = 79;
UPDATE save SET  savecurrentvalue = '-5247750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-4247750.00','1000000', '1', '1', 'ايصال دفع لمورد', '326', '-5247750', '2026-10-09 21:15:57', '1',  'supplierPayedDeptController.php','0','','0'); -- id=450
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1000000', '1000000', '2026-10-09', '1', '0', '0', '2026-10-09 21:15:57','ايصال دفع لمورد ( فرنكو ) ','1','0','-1','0','326','supplierReportsController.php?do=show&id=326'); -- id=1944
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1944', '505', '1000000', '','0'); -- id=1979
UPDATE accountstree SET name = 'فرنكو', customName = 'فرنكو', customNameEn = 'فرنكو', nameEn = 'فرنكو', parent = '81', accountNature = '1', theValue = '-696026', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 20:20:28' WHERE id = '505';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1944', '383', '1000000', '','0'); -- id=1946
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-5247750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '79', supplierdebtchangebefore = '303974.00', supplierdebtchangeamount = '1000000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-696026.00', supplierdebtchangedate = '2026-10-09 21:15:20', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'عدد 5 شيكات * 200 
من شهر 11 حتي 3', dailyentryid = '1944',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='1000000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='303974',debtchangamountInSupplierCurrency='1000000',debtchangafterInSupplierCurrency='-696026', paySerialNo='35',tagids='' WHERE supplierdebtchangeid = '326';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:45:57";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:15:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:15:57', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6718
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:45:59";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:15:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:15:59', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6719
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:45:59";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:15:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:15:59', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6720
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:46:24";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:16:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:16:24', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6721
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:46:39";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:16:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:16:39', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6722
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:46:49";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:16:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:16:49', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=add'); -- id=6723
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('تومان', '', '', '0', '', '0', '1', '2026-10-09 21:16:49', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=141
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 ('141', '0', '0', '0', 'إضافة مورد جديد', '141', '0', '2026-10-09 21:16:49', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=327
UPDATE client SET clientname = '', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '', clientdetails = '', conditions = null, clientdate = '', userid = null  , clientareaid = null  ,clientcode = '',dailyentryid = null , rondomtxt = '',clientStoreIds = '', obygyPatientId = '0' , debtLimit='0' , typeclientid='',priceTypeId='0',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '141',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='0',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='0',datecustomeraccount='',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='' WHERE clientid = null;
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('تومان', 'تومان', 'تومان', 'تومان', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 21:16:49'); -- id=624
UPDATE supplier SET suppliername = 'تومان', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='624',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '141';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:46:49";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:16:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:16:49', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=sucess'); -- id=6724
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:46:51";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:16:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:16:51', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=show'); -- id=6725
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:46:56";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:16:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:16:56', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6726
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:47:23";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:17:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:17:23', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6727
BEGIN;
CALL supplierInUse(127,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('127', '148338.00', '400000', '1', 'ايصال دفع لمورد', '1', '-251662', '2026-10-09 21:14:44', '1', 'supplierPayedDeptController.php', '4 شيكات * 100 الف', '0','1', '-1','1','1','400000','1','0','0','0','35',''); -- id=328
UPDATE supplierdebtchange SET supplierid = '127', supplierdebtchangebefore = '148338.00', supplierdebtchangeamount = '400000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-251662', supplierdebtchangedate = '2026-10-09 21:14:44', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '4 شيكات * 100 الف', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='400000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='148338',debtchangamountInSupplierCurrency='400000',debtchangafterInSupplierCurrency='-251662', paySerialNo='35',tagids='' WHERE supplierdebtchangeid = '328';
UPDATE supplier SET  suppliercurrentDebt = '-251662',suppliercurrentDebtInCurrency= '-251662' , userid = '1', supplierdate = '2026-10-09 21:17:23'   WHERE supplierid = '127';
UPDATE supplier SET  inUse = 0 where supplierid = 127;
UPDATE save SET  savecurrentvalue = '-5647750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-5247750.00','400000', '1', '1', 'ايصال دفع لمورد', '328', '-5647750', '2026-10-09 21:17:23', '1',  'supplierPayedDeptController.php','0','','0'); -- id=451
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '400000', '400000', '2026-10-09', '1', '0', '0', '2026-10-09 21:17:23','ايصال دفع لمورد ( الاصلي ) ','1','0','0','0','328','supplierReportsController.php?do=show&id=328'); -- id=1945
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1945', '610', '400000', '','0'); -- id=1980
UPDATE accountstree SET name = 'الاصلي', customName = 'الاصلي', customNameEn = 'الاصلي', nameEn = 'الاصلي', parent = '81', accountNature = '1', theValue = '-251662', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 14:26:05' WHERE id = '610';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1945', '383', '400000', '','0'); -- id=1947
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-5647750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '127', supplierdebtchangebefore = '148338.00', supplierdebtchangeamount = '400000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-251662.00', supplierdebtchangedate = '2026-10-09 21:14:44', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '4 شيكات * 100 الف', dailyentryid = '1945',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='400000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='148338',debtchangamountInSupplierCurrency='400000',debtchangafterInSupplierCurrency='-251662', paySerialNo='35',tagids='' WHERE supplierdebtchangeid = '328';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:47:23";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:17:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:17:23', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6728
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:47:25";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:17:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:17:25', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6729
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:47:25";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:17:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:17:25', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6730
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:47:46";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:17:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:17:46', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6731
BEGIN;
CALL supplierInUse(141,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('141', '0.00', '300000', '1', 'ايصال دفع لمورد', '1', '-300000', '2026-10-09 21:16:56', '1', 'supplierPayedDeptController.php', 'دفعة 100 الف نقدي
200 شيك 25 -11', '0','1', '-1','1','1','300000','1','0','0','0','36',''); -- id=329
UPDATE supplierdebtchange SET supplierid = '141', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '300000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-300000', supplierdebtchangedate = '2026-10-09 21:16:56', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة 100 الف نقدي
200 شيك 25 -11', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='300000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='300000',debtchangafterInSupplierCurrency='-300000', paySerialNo='36',tagids='' WHERE supplierdebtchangeid = '329';
UPDATE supplier SET  suppliercurrentDebt = '-300000',suppliercurrentDebtInCurrency= '-300000' , userid = '1', supplierdate = '2026-10-09 21:17:46'   WHERE supplierid = '141';
UPDATE supplier SET  inUse = 0 where supplierid = 141;
UPDATE save SET  savecurrentvalue = '-5947750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-5647750.00','300000', '1', '1', 'ايصال دفع لمورد', '329', '-5947750', '2026-10-09 21:17:46', '1',  'supplierPayedDeptController.php','0','','0'); -- id=452
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '300000', '300000', '2026-10-09', '1', '0', '0', '2026-10-09 21:17:46','ايصال دفع لمورد ( تومان ) ','1','0','-1','0','329','supplierReportsController.php?do=show&id=329'); -- id=1946
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1946', '624', '300000', '','0'); -- id=1981
UPDATE accountstree SET name = 'تومان', customName = 'تومان', customNameEn = 'تومان', nameEn = 'تومان', parent = '81', accountNature = '1', theValue = '-300000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:16:49' WHERE id = '624';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1946', '383', '300000', '','0'); -- id=1948
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-5947750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '141', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '300000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-300000.00', supplierdebtchangedate = '2026-10-09 21:16:56', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة 100 الف نقدي
200 شيك 25 -11', dailyentryid = '1946',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='300000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='300000',debtchangafterInSupplierCurrency='-300000', paySerialNo='36',tagids='' WHERE supplierdebtchangeid = '329';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:47:47";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:17:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:17:47', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6732
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:47:48";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:17:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:17:48', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6733
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:47:48";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:17:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:17:48', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6734
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:48:03";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:18:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:18:03', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6735
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:48:19";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:18:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:18:19', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php'); -- id=6736
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:48:47";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:18:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:18:47', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6737
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:48:59";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:18:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:18:59', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=add'); -- id=6738

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =502
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(50,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '69987.5' , clientdate = '2026-10-09 21:18:59', userid = '1' WHERE clientid = '50';
UPDATE client SET  inUse = 0 where clientid = 50;
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 ('50','99987.50','30000','1','ايصال تحصيل (( قبض من عميل ))','502', '69987.5', '2026-09-24  21:30:41', '1', 'clientPayedDeptController.php', '   ', '30000', '0', null, '0', null, null,'', '-1','1','1','30000','1','','484','0','','.'); -- id=502
UPDATE save SET  savecurrentvalue = '-5917750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-5947750.00','30000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '502', '-5917750', '2026-10-09 21:18:59', '1',  'clientPayedDeptController.php','50','','0'); -- id=453
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '30000', '30000', '2026-10-09', '1', '0', '0', '2026-10-09 21:18:59','اضافة ايصال سداد للعميل حكيم - عميل','1','0','0','0','502','clientPayedDeptController.php?do=show&id=502'); -- id=1947
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1947', '383', '30000', '','0'); -- id=1982
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-5917750', 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 ('1947', '548', '30000', '','0'); -- id=1949
UPDATE accountstree SET name = 'حكيم - عميل', customName = 'حكيم - عميل', customNameEn = 'حكيم - عميل', nameEn = 'حكيم - عميل', parent = '58', accountNature = '0', theValue = '-30000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:06' WHERE id = '548';
UPDATE clientdebtchange SET clientid = '50', clientdebtchangebefore = '99987.500', clientdebtchangeamount = '30000.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '502', clientdebtchangeafter = '69987.500', clientdebtchangedate = '2026-09-24 21:30:41', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '30000.000',discount='', reciptid='0', dailyentryid = '1947',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='30000',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '502';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:00";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:19:00', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=6739
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:01";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:19:01', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=show'); -- id=6740
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:02";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:19:02', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=add'); -- id=6741
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('اوريجنال - مورد', '', '', '0', '', '0', '1', '2026-10-09 21:19:02', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=142
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 ('142', '0', '0', '0', 'إضافة مورد جديد', '142', '0', '2026-10-09 21:19:02', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=330
UPDATE client SET clientname = '', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '', clientdetails = '', conditions = null, clientdate = '', userid = null  , clientareaid = null  ,clientcode = '',dailyentryid = null , rondomtxt = '',clientStoreIds = '', obygyPatientId = '0' , debtLimit='0' , typeclientid='',priceTypeId='0',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '142',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='0',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='0',datecustomeraccount='',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='' WHERE clientid = null;
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('اوريجنال - مورد', 'اوريجنال - مورد', 'اوريجنال - مورد', 'اوريجنال - مورد', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 21:19:02'); -- id=625
UPDATE supplier SET suppliername = 'اوريجنال - مورد', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='625',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '142';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:02";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:19:02', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=sucess'); -- id=6742
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:04";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:19:04', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php'); -- id=6743
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:04";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:19:04', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=show'); -- id=6744
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:06";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:19:06', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6745
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:22";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:19:22', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=add'); -- id=6746

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =503
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(50,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '19987.5' , clientdate = '2026-10-09 21:19:22', userid = '1' WHERE clientid = '50';
UPDATE client SET  inUse = 0 where clientid = 50;
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 ('50','69987.50','50000','1','ايصال تحصيل (( قبض من عميل ))','503', '19987.5', '2026-10-09 21:19:04', '1', 'clientPayedDeptController.php', '   ', '50000', '0', null, '0', null, null,'', '-1','1','1','50000','1','','485','0','','.'); -- id=503
UPDATE save SET  savecurrentvalue = '-5867750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-5917750.00','50000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '503', '-5867750', '2026-10-09 21:19:22', '1',  'clientPayedDeptController.php','50','','0'); -- id=454
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 21:19:22','اضافة ايصال سداد للعميل حكيم - عميل','1','0','0','0','503','clientPayedDeptController.php?do=show&id=503'); -- id=1948
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1948', '383', '50000', '','0'); -- id=1983
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-5867750', 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 ('1948', '548', '50000', '','0'); -- id=1950
UPDATE accountstree SET name = 'حكيم - عميل', customName = 'حكيم - عميل', customNameEn = 'حكيم - عميل', nameEn = 'حكيم - عميل', parent = '58', accountNature = '0', theValue = '-80000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:06' WHERE id = '548';
UPDATE clientdebtchange SET clientid = '50', clientdebtchangebefore = '69987.500', clientdebtchangeamount = '50000.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '503', clientdebtchangeafter = '19987.500', clientdebtchangedate = '2026-10-09 21:19:04', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '50000.000',discount='', reciptid='0', dailyentryid = '1948',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '503';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:23";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:19:23', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=6747
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:24";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:19:24', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=show'); -- id=6748
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:25";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:19:25', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6749
BEGIN;
CALL supplierInUse(142,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('142', '0.00', '50000', '1', 'ايصال دفع لمورد', '1', '-50000', '2026-10-09 21:19:06', '1', 'supplierPayedDeptController.php', 'دفعة نقدي', '0','1', '-1','1','1','50000','1','0','0','0','37',''); -- id=331
UPDATE supplierdebtchange SET supplierid = '142', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-50000', supplierdebtchangedate = '2026-10-09 21:19:06', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة نقدي', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='-50000', paySerialNo='37',tagids='' WHERE supplierdebtchangeid = '331';
UPDATE supplier SET  suppliercurrentDebt = '-50000',suppliercurrentDebtInCurrency= '-50000' , userid = '1', supplierdate = '2026-10-09 21:19:25'   WHERE supplierid = '142';
UPDATE supplier SET  inUse = 0 where supplierid = 142;
UPDATE save SET  savecurrentvalue = '-5917750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-5867750.00','50000', '1', '1', 'ايصال دفع لمورد', '331', '-5917750', '2026-10-09 21:19:25', '1',  'supplierPayedDeptController.php','0','','0'); -- id=455
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 21:19:25','ايصال دفع لمورد ( اوريجنال - مورد ) ','1','0','-1','0','331','supplierReportsController.php?do=show&id=331'); -- id=1949
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1949', '625', '50000', '','0'); -- id=1984
UPDATE accountstree SET name = 'اوريجنال - مورد', customName = 'اوريجنال - مورد', customNameEn = 'اوريجنال - مورد', nameEn = 'اوريجنال - مورد', parent = '81', accountNature = '1', theValue = '-50000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:19:02' WHERE id = '625';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1949', '383', '50000', '','0'); -- id=1951
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-5917750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '142', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-50000.00', supplierdebtchangedate = '2026-10-09 21:19:06', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة نقدي', dailyentryid = '1949',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='-50000', paySerialNo='37',tagids='' WHERE supplierdebtchangeid = '331';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:26";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:19:26', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6750
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:27";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:19:27', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6751
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:28";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:19:28', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6752
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:38";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:19:38', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6753
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:40";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:19:40', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=show'); -- id=6754
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:51";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:19:51', '1', 'edit', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=edit&id=503'); -- id=6755
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:53";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:19:53', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6756
BEGIN;
CALL supplierInUse(88,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('88', '170400.00', '50000', '1', 'ايصال دفع لمورد', '1', '120400', '2026-10-09 21:19:38', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','50000','1','0','0','0','38',''); -- id=332
UPDATE supplierdebtchange SET supplierid = '88', supplierdebtchangebefore = '170400.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '120400', supplierdebtchangedate = '2026-10-09 21:19:38', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='170400',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='120400', paySerialNo='38',tagids='' WHERE supplierdebtchangeid = '332';
UPDATE supplier SET  suppliercurrentDebt = '120400',suppliercurrentDebtInCurrency= '120400' , userid = '1', supplierdate = '2026-10-09 21:19:53'   WHERE supplierid = '88';
UPDATE supplier SET  inUse = 0 where supplierid = 88;
UPDATE save SET  savecurrentvalue = '-5967750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-5917750.00','50000', '1', '1', 'ايصال دفع لمورد', '332', '-5967750', '2026-10-09 21:19:53', '1',  'supplierPayedDeptController.php','0','','0'); -- id=456
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 21:19:53','ايصال دفع لمورد ( بيدو الالماني ) ','1','0','-1','0','332','supplierReportsController.php?do=show&id=332'); -- id=1950
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1950', '569', '50000', '','0'); -- id=1985
UPDATE accountstree SET name = 'بيدو الالماني', customName = 'بيدو الالماني', customNameEn = 'بيدو الالماني', nameEn = 'بيدو الالماني', parent = '81', accountNature = '1', theValue = '120400', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 16:49:11' WHERE id = '569';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1950', '383', '50000', '','0'); -- id=1952
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-5967750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '88', supplierdebtchangebefore = '170400.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '120400.00', supplierdebtchangedate = '2026-10-09 21:19:38', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1950',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='170400',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='120400', paySerialNo='38',tagids='' WHERE supplierdebtchangeid = '332';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:54";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:19:54', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6757
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:55";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:19:55', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6758
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:56";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:19:56', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6759
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:49:57";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:19:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:19:57', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6760
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:50:04";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:20:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:20:04', '1', 'update', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=update'); -- id=6761
UPDATE clientdebtchange SET comment='      ' WHERE clientdebtchangeid = '503';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:50:04";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:20:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:20:04', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=6762
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:50:05";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:20:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:20:05', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=show'); -- id=6763
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:50:20";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:20:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:20:20', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6764
BEGIN;
CALL supplierInUse(89,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('89', '108000.00', '50000', '1', 'ايصال دفع لمورد', '1', '58000', '2026-10-09 21:19:57', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','50000','1','0','0','0','39',''); -- id=333
UPDATE supplierdebtchange SET supplierid = '89', supplierdebtchangebefore = '108000.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '58000', supplierdebtchangedate = '2026-10-09 21:19:57', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='108000',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='58000', paySerialNo='39',tagids='' WHERE supplierdebtchangeid = '333';
UPDATE supplier SET  suppliercurrentDebt = '58000',suppliercurrentDebtInCurrency= '58000' , userid = '1', supplierdate = '2026-10-09 21:20:20'   WHERE supplierid = '89';
UPDATE supplier SET  inUse = 0 where supplierid = 89;
UPDATE save SET  savecurrentvalue = '-6017750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-5967750.00','50000', '1', '1', 'ايصال دفع لمورد', '333', '-6017750', '2026-10-09 21:20:20', '1',  'supplierPayedDeptController.php','0','','0'); -- id=457
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 21:20:20','ايصال دفع لمورد ( تيتو بولاق ) ','1','0','-1','0','333','supplierReportsController.php?do=show&id=333'); -- id=1951
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1951', '570', '50000', '','0'); -- id=1986
UPDATE accountstree SET name = 'تيتو بولاق', customName = 'تيتو بولاق', customNameEn = 'تيتو بولاق', nameEn = 'تيتو بولاق', parent = '81', accountNature = '1', theValue = '58000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 17:44:52' WHERE id = '570';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1951', '383', '50000', '','0'); -- id=1953
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-6017750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '89', supplierdebtchangebefore = '108000.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '58000.00', supplierdebtchangedate = '2026-10-09 21:19:57', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1951',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='108000',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='58000', paySerialNo='39',tagids='' WHERE supplierdebtchangeid = '333';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:50:21";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:20:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:20:21', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6765
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:50:22";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:20:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:20:22', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6766
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:50:22";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:20:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:20:22', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6767
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:50:49";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:20:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:20:49', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6768
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:51:08";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:21:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:21:08', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6769
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:51:16";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:21:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:21:16', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=add'); -- id=6770
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('بلس', '', '', '0', '', '0', '1', '2026-10-09 21:21:16', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=143
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 ('143', '0', '0', '0', 'إضافة مورد جديد', '143', '0', '2026-10-09 21:21:16', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=334
UPDATE client SET clientname = '', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '', clientdetails = '', conditions = null, clientdate = '', userid = null  , clientareaid = null  ,clientcode = '',dailyentryid = null , rondomtxt = '',clientStoreIds = '', obygyPatientId = '0' , debtLimit='0' , typeclientid='',priceTypeId='0',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '143',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='0',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='0',datecustomeraccount='',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='' WHERE clientid = null;
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('بلس', 'بلس', 'بلس', 'بلس', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 21:21:17'); -- id=626
UPDATE supplier SET suppliername = 'بلس', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='626',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '143';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:51:17";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:21:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:21:17', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=sucess'); -- id=6771
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:51:18";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:21:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:21:18', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=show'); -- id=6772
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:51:20";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:21:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:21:20', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6773
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:52:19";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:22:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:22:19', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6774
BEGIN;
CALL supplierInUse(143,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('143', '0.00', '50000', '1', 'ايصال دفع لمورد', '1', '-50000', '2026-10-09 21:21:20', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','50000','1','0','0','0','40',''); -- id=335
UPDATE supplierdebtchange SET supplierid = '143', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-50000', supplierdebtchangedate = '2026-10-09 21:21:20', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='-50000', paySerialNo='40',tagids='' WHERE supplierdebtchangeid = '335';
UPDATE supplier SET  suppliercurrentDebt = '-50000',suppliercurrentDebtInCurrency= '-50000' , userid = '1', supplierdate = '2026-10-09 21:22:19'   WHERE supplierid = '143';
UPDATE supplier SET  inUse = 0 where supplierid = 143;
UPDATE save SET  savecurrentvalue = '-6067750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-6017750.00','50000', '1', '1', 'ايصال دفع لمورد', '335', '-6067750', '2026-10-09 21:22:19', '1',  'supplierPayedDeptController.php','0','','0'); -- id=458
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 21:22:19','ايصال دفع لمورد ( بلس ) ','1','0','-1','0','335','supplierReportsController.php?do=show&id=335'); -- id=1952
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1952', '626', '50000', '','0'); -- id=1987
UPDATE accountstree SET name = 'بلس', customName = 'بلس', customNameEn = 'بلس', nameEn = 'بلس', parent = '81', accountNature = '1', theValue = '-50000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:21:17' WHERE id = '626';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1952', '383', '50000', '','0'); -- id=1954
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-6067750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '143', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-50000.00', supplierdebtchangedate = '2026-10-09 21:21:20', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1952',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='-50000', paySerialNo='40',tagids='' WHERE supplierdebtchangeid = '335';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:52:20";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:22:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:22:20', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6775
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:52:21";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:22:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:22:21', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6776
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:52:21";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:22:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:22:21', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6777
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:52:36";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:22:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:22:36', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6778
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:53:41";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:23:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:23:41', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6779
BEGIN;
CALL supplierInUse(118,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('118', '248524.20', '350000', '1', 'ايصال دفع لمورد', '1', '-101475.8', '2026-10-09 21:22:36', '1', 'supplierPayedDeptController.php', 'شيك 15-11 ب 150
شيك 15-12 ب 150
50 دفعة نقدي
استفاح', '0','1', '-1','1','1','350000','1','0','0','0','41',''); -- id=336
UPDATE supplierdebtchange SET supplierid = '118', supplierdebtchangebefore = '248524.20', supplierdebtchangeamount = '350000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-101475.8', supplierdebtchangedate = '2026-10-09 21:22:36', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'شيك 15-11 ب 150
شيك 15-12 ب 150
50 دفعة نقدي
استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='350000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='248524.2',debtchangamountInSupplierCurrency='350000',debtchangafterInSupplierCurrency='-101475.8', paySerialNo='41',tagids='' WHERE supplierdebtchangeid = '336';
UPDATE supplier SET  suppliercurrentDebt = '-101475.8',suppliercurrentDebtInCurrency= '-101475.8' , userid = '1', supplierdate = '2026-10-09 21:23:41'   WHERE supplierid = '118';
UPDATE supplier SET  inUse = 0 where supplierid = 118;
UPDATE save SET  savecurrentvalue = '-6417750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-6067750.00','350000', '1', '1', 'ايصال دفع لمورد', '336', '-6417750', '2026-10-09 21:23:41', '1',  'supplierPayedDeptController.php','0','','0'); -- id=459
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '350000', '350000', '2026-10-09', '1', '0', '0', '2026-10-09 21:23:41','ايصال دفع لمورد ( ضرب نار ) ','1','0','-1','0','336','supplierReportsController.php?do=show&id=336'); -- id=1953
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1953', '601', '350000', '','0'); -- id=1988
UPDATE accountstree SET name = 'ضرب نار', customName = 'ضرب نار', customNameEn = 'ضرب نار', nameEn = 'ضرب نار', parent = '81', accountNature = '1', theValue = '-101475.8', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 10:25:59' WHERE id = '601';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1953', '383', '350000', '','0'); -- id=1955
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-6417750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '118', supplierdebtchangebefore = '248524.20', supplierdebtchangeamount = '350000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-101475.80', supplierdebtchangedate = '2026-10-09 21:22:36', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'شيك 15-11 ب 150
شيك 15-12 ب 150
50 دفعة نقدي
استفاح', dailyentryid = '1953',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='350000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='248524.2',debtchangamountInSupplierCurrency='350000',debtchangafterInSupplierCurrency='-101475.8', paySerialNo='41',tagids='' WHERE supplierdebtchangeid = '336';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:53:42";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:23:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:23:42', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6780
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:53:43";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:23:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:23:43', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6781
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:53:43";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:23:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:23:43', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6782
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:53:55";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:23:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:23:55', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6783
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:54:05";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:24:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:24:05', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6784
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:54:12";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:24:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:24:12', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6785
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:54:22";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:24:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:24:22', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=add'); -- id=6786
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('بوينت وان', '', '', '0', '', '0', '1', '2026-10-09 21:24:22', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=144
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 ('144', '0', '0', '0', 'إضافة مورد جديد', '144', '0', '2026-10-09 21:24:22', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=337
UPDATE client SET clientname = '', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '', clientdetails = '', conditions = null, clientdate = '', userid = null  , clientareaid = null  ,clientcode = '',dailyentryid = null , rondomtxt = '',clientStoreIds = '', obygyPatientId = '0' , debtLimit='0' , typeclientid='',priceTypeId='0',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '144',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='0',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='0',datecustomeraccount='',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='' WHERE clientid = null;
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('بوينت وان', 'بوينت وان', 'بوينت وان', 'بوينت وان', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 21:24:22'); -- id=627
UPDATE supplier SET suppliername = 'بوينت وان', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='627',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '144';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:54:23";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:24:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:24:23', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=sucess'); -- id=6787
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:54:24";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:24:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:24:24', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=show'); -- id=6788
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:55:03";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:25:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:25:03', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6789
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:55:32";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:25:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:25:32', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6790
BEGIN;
CALL supplierInUse(144,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('144', '0.00', '50000', '1', 'ايصال دفع لمورد', '1', '-50000', '2026-10-09 21:25:03', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','50000','1','0','0','0','42',''); -- id=338
UPDATE supplierdebtchange SET supplierid = '144', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-50000', supplierdebtchangedate = '2026-10-09 21:25:03', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='-50000', paySerialNo='42',tagids='' WHERE supplierdebtchangeid = '338';
UPDATE supplier SET  suppliercurrentDebt = '-50000',suppliercurrentDebtInCurrency= '-50000' , userid = '1', supplierdate = '2026-10-09 21:25:32'   WHERE supplierid = '144';
UPDATE supplier SET  inUse = 0 where supplierid = 144;
UPDATE save SET  savecurrentvalue = '-6467750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-6417750.00','50000', '1', '1', 'ايصال دفع لمورد', '338', '-6467750', '2026-10-09 21:25:32', '1',  'supplierPayedDeptController.php','0','','0'); -- id=460
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 21:25:32','ايصال دفع لمورد ( بوينت وان ) ','1','0','-1','0','338','supplierReportsController.php?do=show&id=338'); -- id=1954
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1954', '627', '50000', '','0'); -- id=1989
UPDATE accountstree SET name = 'بوينت وان', customName = 'بوينت وان', customNameEn = 'بوينت وان', nameEn = 'بوينت وان', parent = '81', accountNature = '1', theValue = '-50000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:24:22' WHERE id = '627';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1954', '383', '50000', '','0'); -- id=1956
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-6467750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '144', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-50000.00', supplierdebtchangedate = '2026-10-09 21:25:03', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1954',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='-50000', paySerialNo='42',tagids='' WHERE supplierdebtchangeid = '338';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:55:33";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:25:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:25:33', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6791
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:55:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:25:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:25:34', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6792
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:55:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:25:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:25:34', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6793
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:55:37";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:25:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:25:37', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6794
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:55:39";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:25:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:25:39', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6795
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:55:49";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:25:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:25:49', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=add'); -- id=6796
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('يوني شيرت', '', '', '0', '', '0', '1', '2026-10-09 21:25:49', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=145
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 ('145', '0', '0', '0', 'إضافة مورد جديد', '145', '0', '2026-10-09 21:25:49', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=339
UPDATE client SET clientname = '', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '', clientdetails = '', conditions = null, clientdate = '', userid = null  , clientareaid = null  ,clientcode = '',dailyentryid = null , rondomtxt = '',clientStoreIds = '', obygyPatientId = '0' , debtLimit='0' , typeclientid='',priceTypeId='0',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '145',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='0',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='0',datecustomeraccount='',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='' WHERE clientid = null;
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('يوني شيرت', 'يوني شيرت', 'يوني شيرت', 'يوني شيرت', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 21:25:49'); -- id=628
UPDATE supplier SET suppliername = 'يوني شيرت', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='628',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '145';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:55:49";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:25:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:25:49', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=sucess'); -- id=6797
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:55:51";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:25:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:25:51', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=show'); -- id=6798
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:55:53";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:25:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:25:53', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6799
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:56:19";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:26:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:26:19', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6800
BEGIN;
CALL supplierInUse(145,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('145', '0.00', '50000', '1', 'ايصال دفع لمورد', '1', '-50000', '2026-10-09 21:25:53', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','50000','1','0','0','0','43',''); -- id=340
UPDATE supplierdebtchange SET supplierid = '145', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-50000', supplierdebtchangedate = '2026-10-09 21:25:53', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='-50000', paySerialNo='43',tagids='' WHERE supplierdebtchangeid = '340';
UPDATE supplier SET  suppliercurrentDebt = '-50000',suppliercurrentDebtInCurrency= '-50000' , userid = '1', supplierdate = '2026-10-09 21:26:19'   WHERE supplierid = '145';
UPDATE supplier SET  inUse = 0 where supplierid = 145;
UPDATE save SET  savecurrentvalue = '-6517750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-6467750.00','50000', '1', '1', 'ايصال دفع لمورد', '340', '-6517750', '2026-10-09 21:26:19', '1',  'supplierPayedDeptController.php','0','','0'); -- id=461
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 21:26:19','ايصال دفع لمورد ( يوني شيرت ) ','1','0','-1','0','340','supplierReportsController.php?do=show&id=340'); -- id=1955
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1955', '628', '50000', '','0'); -- id=1990
UPDATE accountstree SET name = 'يوني شيرت', customName = 'يوني شيرت', customNameEn = 'يوني شيرت', nameEn = 'يوني شيرت', parent = '81', accountNature = '1', theValue = '-50000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:25:49' WHERE id = '628';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1955', '383', '50000', '','0'); -- id=1957
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-6517750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '145', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-50000.00', supplierdebtchangedate = '2026-10-09 21:25:53', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1955',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='-50000', paySerialNo='43',tagids='' WHERE supplierdebtchangeid = '340';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:56:19";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:26:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:26:19', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6801
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:56:21";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:26:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:26:21', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6802
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:56:21";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:26:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:26:21', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6803
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:56:28";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:26:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:26:28', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6804
BEGIN;
CALL supplierInUse(133,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('133', '-200000.00', '25000000', '1', 'ايصال دفع لمورد', '1', '-25200000', '2026-10-09 21:24:12', '1', 'supplierPayedDeptController.php', '5 شيكات * 500 الف من تاريخ 30 / 10 حتي 28 / 2', '0','1', '-1','1','1','25000000','1','0','0','0','42',''); -- id=341
UPDATE supplierdebtchange SET supplierid = '133', supplierdebtchangebefore = '-200000.00', supplierdebtchangeamount = '25000000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-25200000', supplierdebtchangedate = '2026-10-09 21:24:12', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '5 شيكات * 500 الف من تاريخ 30 / 10 حتي 28 / 2', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='25000000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='-200000',debtchangamountInSupplierCurrency='25000000',debtchangafterInSupplierCurrency='-25200000', paySerialNo='42',tagids='' WHERE supplierdebtchangeid = '341';
UPDATE supplier SET  suppliercurrentDebt = '-25200000',suppliercurrentDebtInCurrency= '-25200000' , userid = '1', supplierdate = '2026-10-09 21:26:28'   WHERE supplierid = '133';
UPDATE supplier SET  inUse = 0 where supplierid = 133;
UPDATE save SET  savecurrentvalue = '-31517750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-6517750.00','25000000', '1', '1', 'ايصال دفع لمورد', '341', '-31517750', '2026-10-09 21:26:28', '1',  'supplierPayedDeptController.php','0','','0'); -- id=462
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '25000000', '25000000', '2026-10-09', '1', '0', '0', '2026-10-09 21:26:28','ايصال دفع لمورد ( فولكانو تيشيرت ) ','1','0','0','0','341','supplierReportsController.php?do=show&id=341'); -- id=1956
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1956', '616', '25000000', '','0'); -- id=1991
UPDATE accountstree SET name = 'فولكانو تيشيرت', customName = 'فولكانو تيشيرت', customNameEn = 'فولكانو تيشيرت', nameEn = 'فولكانو تيشيرت', parent = '81', accountNature = '1', theValue = '-25200000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 21:57:44' WHERE id = '616';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1956', '383', '25000000', '','0'); -- id=1958
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-31517750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '133', supplierdebtchangebefore = '-200000.00', supplierdebtchangeamount = '25000000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-25200000.00', supplierdebtchangedate = '2026-10-09 21:24:12', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '5 شيكات * 500 الف من تاريخ 30 / 10 حتي 28 / 2', dailyentryid = '1956',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='25000000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='-200000',debtchangamountInSupplierCurrency='25000000',debtchangafterInSupplierCurrency='-25200000', paySerialNo='42',tagids='' WHERE supplierdebtchangeid = '341';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:56:28";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:26:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:26:28', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6805
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:56:29";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:26:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:26:29', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6806
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:56:30";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:26:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:26:30', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6807
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:56:31";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:26:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:26:31', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6808
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:56:48";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:26:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:26:48', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6809
BEGIN;
CALL supplierInUse(120,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('120', '122820.00', '50000', '1', 'ايصال دفع لمورد', '1', '72820', '2026-10-09 21:26:31', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','50000','1','0','0','0','44',''); -- id=342
UPDATE supplierdebtchange SET supplierid = '120', supplierdebtchangebefore = '122820.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '72820', supplierdebtchangedate = '2026-10-09 21:26:31', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='122820',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='72820', paySerialNo='44',tagids='' WHERE supplierdebtchangeid = '342';
UPDATE supplier SET  suppliercurrentDebt = '72820',suppliercurrentDebtInCurrency= '72820' , userid = '1', supplierdate = '2026-10-09 21:26:48'   WHERE supplierid = '120';
UPDATE supplier SET  inUse = 0 where supplierid = 120;
UPDATE save SET  savecurrentvalue = '-31567750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-31517750.00','50000', '1', '1', 'ايصال دفع لمورد', '342', '-31567750', '2026-10-09 21:26:48', '1',  'supplierPayedDeptController.php','0','','0'); -- id=463
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 21:26:48','ايصال دفع لمورد ( بوم ) ','1','0','-1','0','342','supplierReportsController.php?do=show&id=342'); -- id=1957
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1957', '603', '50000', '','0'); -- id=1992
UPDATE accountstree SET name = 'بوم', customName = 'بوم', customNameEn = 'بوم', nameEn = 'بوم', parent = '81', accountNature = '1', theValue = '72820', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 10:47:37' WHERE id = '603';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1957', '383', '50000', '','0'); -- id=1959
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-31567750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '120', supplierdebtchangebefore = '122820.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '72820.00', supplierdebtchangedate = '2026-10-09 21:26:31', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1957',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='122820',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='72820', paySerialNo='44',tagids='' WHERE supplierdebtchangeid = '342';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:56:48";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:26:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:26:48', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6810
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:56:49";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:26:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:26:49', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6811
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:56:50";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:26:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:26:50', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6812
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:57:01";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:27:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:27:01', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6813
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:57:18";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:27:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:27:18', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6814
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:57:48";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:27:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:27:48', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6815
BEGIN;
CALL supplierInUse(111,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('111', '139667.40', '100000', '1', 'ايصال دفع لمورد', '1', '39667.4', '2026-10-09 21:27:18', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','100000','1','0','0','0','45',''); -- id=343
UPDATE supplierdebtchange SET supplierid = '111', supplierdebtchangebefore = '139667.40', supplierdebtchangeamount = '100000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '39667.4', supplierdebtchangedate = '2026-10-09 21:27:18', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='139667.4',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='39667.4', paySerialNo='45',tagids='' WHERE supplierdebtchangeid = '343';
UPDATE supplier SET  suppliercurrentDebt = '39667.4',suppliercurrentDebtInCurrency= '39667.4' , userid = '1', supplierdate = '2026-10-09 21:27:48'   WHERE supplierid = '111';
UPDATE supplier SET  inUse = 0 where supplierid = 111;
UPDATE save SET  savecurrentvalue = '-31667750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-31567750.00','100000', '1', '1', 'ايصال دفع لمورد', '343', '-31667750', '2026-10-09 21:27:48', '1',  'supplierPayedDeptController.php','0','','0'); -- id=464
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '100000', '100000', '2026-10-09', '1', '0', '0', '2026-10-09 21:27:48','ايصال دفع لمورد ( باور ماكس ) ','1','0','-1','0','343','supplierReportsController.php?do=show&id=343'); -- id=1958
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1958', '594', '100000', '','0'); -- id=1993
UPDATE accountstree SET name = 'باور ماكس', customName = 'باور ماكس', customNameEn = 'باور ماكس', nameEn = 'باور ماكس', parent = '81', accountNature = '1', theValue = '39667.4', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-07 16:56:48' WHERE id = '594';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1958', '383', '100000', '','0'); -- id=1960
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-31667750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '111', supplierdebtchangebefore = '139667.40', supplierdebtchangeamount = '100000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '39667.40', supplierdebtchangedate = '2026-10-09 21:27:18', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1958',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='139667.4',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='39667.4', paySerialNo='45',tagids='' WHERE supplierdebtchangeid = '343';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:57:48";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:27:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:27:48', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6816
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:57:50";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:27:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:27:50', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6817
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:57:50";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:27:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:27:50', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6818
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:57:59";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:27:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:27:59', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6819
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:58:03";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:28:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:28:03', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6820
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:58:09";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:28:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:28:09', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6821
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:58:11";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:28:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:28:11', '1', 'editprint', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=editprint&id=281'); -- id=6822
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:59:33";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:29:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:29:33', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6823
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:59:46";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:29:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:29:46', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=add'); -- id=6824
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('بوتشر مصر - مورد', '', '', '0', '', '0', '1', '2026-10-09 21:29:46', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=146
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 ('146', '0', '0', '0', 'إضافة مورد جديد', '146', '0', '2026-10-09 21:29:46', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=344
UPDATE client SET clientname = '', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '', clientdetails = '', conditions = null, clientdate = '', userid = null  , clientareaid = null  ,clientcode = '',dailyentryid = null , rondomtxt = '',clientStoreIds = '', obygyPatientId = '0' , debtLimit='0' , typeclientid='',priceTypeId='0',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '146',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='0',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='0',datecustomeraccount='',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='' WHERE clientid = null;
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('بوتشر مصر - مورد', 'بوتشر مصر - مورد', 'بوتشر مصر - مورد', 'بوتشر مصر - مورد', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 21:29:46'); -- id=629
UPDATE supplier SET suppliername = 'بوتشر مصر - مورد', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='629',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '146';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:59:46";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:29:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:29:46', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=sucess'); -- id=6825
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:59:48";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:29:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:29:48', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=show'); -- id=6826
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 17:59:48";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:29:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:29:48', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6827
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:00:06";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:30:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:30:06', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6828
BEGIN;
CALL supplierInUse(146,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('146', '0.00', '150000', '1', 'ايصال دفع لمورد', '1', '-150000', '2026-10-09 21:29:48', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','150000','1','0','0','0','46',''); -- id=345
UPDATE supplierdebtchange SET supplierid = '146', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '150000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-150000', supplierdebtchangedate = '2026-10-09 21:29:48', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='150000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='150000',debtchangafterInSupplierCurrency='-150000', paySerialNo='46',tagids='' WHERE supplierdebtchangeid = '345';
UPDATE supplier SET  suppliercurrentDebt = '-150000',suppliercurrentDebtInCurrency= '-150000' , userid = '1', supplierdate = '2026-10-09 21:30:06'   WHERE supplierid = '146';
UPDATE supplier SET  inUse = 0 where supplierid = 146;
UPDATE save SET  savecurrentvalue = '-31817750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-31667750.00','150000', '1', '1', 'ايصال دفع لمورد', '345', '-31817750', '2026-10-09 21:30:06', '1',  'supplierPayedDeptController.php','0','','0'); -- id=465
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '150000', '150000', '2026-10-09', '1', '0', '0', '2026-10-09 21:30:06','ايصال دفع لمورد ( بوتشر مصر - مورد ) ','1','0','-1','0','345','supplierReportsController.php?do=show&id=345'); -- id=1959
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1959', '629', '150000', '','0'); -- id=1994
UPDATE accountstree SET name = 'بوتشر مصر - مورد', customName = 'بوتشر مصر - مورد', customNameEn = 'بوتشر مصر - مورد', nameEn = 'بوتشر مصر - مورد', parent = '81', accountNature = '1', theValue = '-150000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:29:46' WHERE id = '629';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1959', '383', '150000', '','0'); -- id=1961
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-31817750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '146', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '150000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-150000.00', supplierdebtchangedate = '2026-10-09 21:29:48', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1959',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='150000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='150000',debtchangafterInSupplierCurrency='-150000', paySerialNo='46',tagids='' WHERE supplierdebtchangeid = '345';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:00:07";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:30:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:30:07', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6829
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:00:08";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:30:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:30:08', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6830
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:00:09";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:30:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:30:09', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6831
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:00:13";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:30:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:30:13', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6832
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:00:19";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:30:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:30:19', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6833
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:01:16";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:31:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:31:16', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6834
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:01:54";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:31:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:31:54', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6835
BEGIN;
CALL supplierInUse(78,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('78', '1121860.00', '50000', '1', 'ايصال دفع لمورد', '1', '1071860', '2026-10-09 21:31:16', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','50000','1','0','0','0','47',''); -- id=346
UPDATE supplierdebtchange SET supplierid = '78', supplierdebtchangebefore = '1121860.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '1071860', supplierdebtchangedate = '2026-10-09 21:31:16', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='1121860',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='1071860', paySerialNo='47',tagids='' WHERE supplierdebtchangeid = '346';
UPDATE supplier SET  suppliercurrentDebt = '1071860',suppliercurrentDebtInCurrency= '1071860' , userid = '1', supplierdate = '2026-10-09 21:31:54'   WHERE supplierid = '78';
UPDATE supplier SET  inUse = 0 where supplierid = 78;
UPDATE save SET  savecurrentvalue = '-31867750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-31817750.00','50000', '1', '1', 'ايصال دفع لمورد', '346', '-31867750', '2026-10-09 21:31:54', '1',  'supplierPayedDeptController.php','0','','0'); -- id=466
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 21:31:54','ايصال دفع لمورد ( احمد الكاشف ) ','1','0','-1','0','346','supplierReportsController.php?do=show&id=346'); -- id=1960
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1960', '504', '50000', '','0'); -- id=1995
UPDATE accountstree SET name = 'احمد الكاشف', customName = 'احمد الكاشف', customNameEn = 'احمد الكاشف', nameEn = 'احمد الكاشف', parent = '81', accountNature = '1', theValue = '1071860', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 19:10:02' WHERE id = '504';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1960', '383', '50000', '','0'); -- id=1962
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-31867750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '78', supplierdebtchangebefore = '1121860.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '1071860.00', supplierdebtchangedate = '2026-10-09 21:31:16', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1960',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='1121860',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='1071860', paySerialNo='47',tagids='' WHERE supplierdebtchangeid = '346';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:01:54";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:31:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:31:54', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6836
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:01:56";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:31:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:31:56', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6837
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:01:56";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:31:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:31:56', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6838
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:02:01";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:32:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:32:01', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6839
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:03:38";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:33:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:33:38', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6840
BEGIN;
CALL supplierInUse(106,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('106', '428290.00', '1800000', '1', 'ايصال دفع لمورد', '1', '-1371710', '2026-10-09 21:32:01', '1', 'supplierPayedDeptController.php', 'دفعة استفاح
عدد 8 شيكات * 200 الف
200 الف نقدي', '0','1', '-1','1','1','1800000','1','0','0','0','48',''); -- id=347
UPDATE supplierdebtchange SET supplierid = '106', supplierdebtchangebefore = '428290.00', supplierdebtchangeamount = '1800000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-1371710', supplierdebtchangedate = '2026-10-09 21:32:01', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح
عدد 8 شيكات * 200 الف
200 الف نقدي', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='1800000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='428290',debtchangamountInSupplierCurrency='1800000',debtchangafterInSupplierCurrency='-1371710', paySerialNo='48',tagids='' WHERE supplierdebtchangeid = '347';
UPDATE supplier SET  suppliercurrentDebt = '-1371710',suppliercurrentDebtInCurrency= '-1371710' , userid = '1', supplierdate = '2026-10-09 21:33:38'   WHERE supplierid = '106';
UPDATE supplier SET  inUse = 0 where supplierid = 106;
UPDATE save SET  savecurrentvalue = '-33667750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-31867750.00','1800000', '1', '1', 'ايصال دفع لمورد', '347', '-33667750', '2026-10-09 21:33:38', '1',  'supplierPayedDeptController.php','0','','0'); -- id=467
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1800000', '1800000', '2026-10-09', '1', '0', '0', '2026-10-09 21:33:38','ايصال دفع لمورد ( تمبو ) ','1','0','-1','0','347','supplierReportsController.php?do=show&id=347'); -- id=1961
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1961', '589', '1800000', '','0'); -- id=1996
UPDATE accountstree SET name = 'تمبو', customName = 'تمبو', customNameEn = 'تمبو', nameEn = 'تمبو', parent = '81', accountNature = '1', theValue = '-1371710', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-07 09:33:15' WHERE id = '589';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1961', '383', '1800000', '','0'); -- id=1963
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-33667750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '106', supplierdebtchangebefore = '428290.00', supplierdebtchangeamount = '1800000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-1371710.00', supplierdebtchangedate = '2026-10-09 21:32:01', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح
عدد 8 شيكات * 200 الف
200 الف نقدي', dailyentryid = '1961',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='1800000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='428290',debtchangamountInSupplierCurrency='1800000',debtchangafterInSupplierCurrency='-1371710', paySerialNo='48',tagids='' WHERE supplierdebtchangeid = '347';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:03:38";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:33:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:33:38', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6841
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:03:39";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:33:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:33:39', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6842
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:03:40";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:33:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:33:40', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6843
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:03:45";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:33:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:33:45', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6844
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:03:59";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:33:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:33:59', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=add'); -- id=6845
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('او ار', '', '', '0', '', '0', '1', '2026-10-09 21:33:59', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=147
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 ('147', '0', '0', '0', 'إضافة مورد جديد', '147', '0', '2026-10-09 21:33:59', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=348
UPDATE client SET clientname = '', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '', clientdetails = '', conditions = null, clientdate = '', userid = null  , clientareaid = null  ,clientcode = '',dailyentryid = null , rondomtxt = '',clientStoreIds = '', obygyPatientId = '0' , debtLimit='0' , typeclientid='',priceTypeId='0',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '147',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='0',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='0',datecustomeraccount='',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='' WHERE clientid = null;
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('او ار', 'او ار', 'او ار', 'او ار', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 21:33:59'); -- id=630
UPDATE supplier SET suppliername = 'او ار', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='630',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '147';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:04:00";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:34:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:34:00', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=sucess'); -- id=6846
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:04:01";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:34:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:34:01', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=show'); -- id=6847
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:04:03";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:34:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:34:03', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6848
UPDATE user SET loginip = "" WHERE userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:04:37";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:34:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:34:37', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6849
BEGIN;
CALL supplierInUse(147,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('147', '0.00', '100000', '1', 'ايصال دفع لمورد', '1', '-100000', '2026-10-09 21:34:03', '1', 'supplierPayedDeptController.php', 'دفعة استفاح
', '0','1', '-1','1','1','100000','1','0','0','0','49',''); -- id=349
UPDATE supplierdebtchange SET supplierid = '147', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '100000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-100000', supplierdebtchangedate = '2026-10-09 21:34:03', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح
', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='-100000', paySerialNo='49',tagids='' WHERE supplierdebtchangeid = '349';
UPDATE supplier SET  suppliercurrentDebt = '-100000',suppliercurrentDebtInCurrency= '-100000' , userid = '1', supplierdate = '2026-10-09 21:34:37'   WHERE supplierid = '147';
UPDATE supplier SET  inUse = 0 where supplierid = 147;
UPDATE save SET  savecurrentvalue = '-33767750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-33667750.00','100000', '1', '1', 'ايصال دفع لمورد', '349', '-33767750', '2026-10-09 21:34:37', '1',  'supplierPayedDeptController.php','0','','0'); -- id=468
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '100000', '100000', '2026-10-09', '1', '0', '0', '2026-10-09 21:34:37','ايصال دفع لمورد ( او ار ) ','1','0','-1','0','349','supplierReportsController.php?do=show&id=349'); -- id=1962
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1962', '630', '100000', '','0'); -- id=1997
UPDATE accountstree SET name = 'او ار', customName = 'او ار', customNameEn = 'او ار', nameEn = 'او ار', parent = '81', accountNature = '1', theValue = '-100000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:33:59' WHERE id = '630';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1962', '383', '100000', '','0'); -- id=1964
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-33767750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '147', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '100000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-100000.00', supplierdebtchangedate = '2026-10-09 21:34:03', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح
', dailyentryid = '1962',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='-100000', paySerialNo='49',tagids='' WHERE supplierdebtchangeid = '349';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:04:37";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:34:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:34:37', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6850
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:04:39";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:34:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:34:39', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6851
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:04:39";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:34:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:34:39', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6852
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:04:40";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:34:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:34:40', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6853
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:04:48";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:34:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:34:48', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6854
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:05:04";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:35:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:35:04', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6855
BEGIN;
CALL supplierInUse(117,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('117', '318729.60', '100000', '1', 'ايصال دفع لمورد', '1', '218729.6', '2026-10-09 21:34:48', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','100000','1','0','0','0','50',''); -- id=350
UPDATE supplierdebtchange SET supplierid = '117', supplierdebtchangebefore = '318729.60', supplierdebtchangeamount = '100000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '218729.6', supplierdebtchangedate = '2026-10-09 21:34:48', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='318729.6',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='218729.6', paySerialNo='50',tagids='' WHERE supplierdebtchangeid = '350';
UPDATE supplier SET  suppliercurrentDebt = '218729.6',suppliercurrentDebtInCurrency= '218729.6' , userid = '1', supplierdate = '2026-10-09 21:35:04'   WHERE supplierid = '117';
UPDATE supplier SET  inUse = 0 where supplierid = 117;
UPDATE save SET  savecurrentvalue = '-33867750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-33767750.00','100000', '1', '1', 'ايصال دفع لمورد', '350', '-33867750', '2026-10-09 21:35:04', '1',  'supplierPayedDeptController.php','0','','0'); -- id=469
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '100000', '100000', '2026-10-09', '1', '0', '0', '2026-10-09 21:35:04','ايصال دفع لمورد ( قلبظ ) ','1','0','-1','0','350','supplierReportsController.php?do=show&id=350'); -- id=1963
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1963', '600', '100000', '','0'); -- id=1998
UPDATE accountstree SET name = 'قلبظ', customName = 'قلبظ', customNameEn = 'قلبظ', nameEn = 'قلبظ', parent = '81', accountNature = '1', theValue = '218729.6', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 10:09:10' WHERE id = '600';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1963', '383', '100000', '','0'); -- id=1965
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-33867750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '117', supplierdebtchangebefore = '318729.60', supplierdebtchangeamount = '100000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '218729.60', supplierdebtchangedate = '2026-10-09 21:34:48', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1963',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='318729.6',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='218729.6', paySerialNo='50',tagids='' WHERE supplierdebtchangeid = '350';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:05:05";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:35:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:35:05', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6856
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:05:06";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:35:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:35:06', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6857
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:05:06";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:35:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:35:06', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6858
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:05:15";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:35:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:35:15', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6859
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:05:24";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:35:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:35:24', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6860
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:05:33";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:35:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:35:33', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=add'); -- id=6861
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('دونجا - مورد', '', '', '0', '', '0', '1', '2026-10-09 21:35:33', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=148
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 ('148', '0', '0', '0', 'إضافة مورد جديد', '148', '0', '2026-10-09 21:35:33', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=351
UPDATE client SET clientname = '', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '', clientdetails = '', conditions = null, clientdate = '', userid = null  , clientareaid = null  ,clientcode = '',dailyentryid = null , rondomtxt = '',clientStoreIds = '', obygyPatientId = '0' , debtLimit='0' , typeclientid='',priceTypeId='0',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '148',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='0',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='0',datecustomeraccount='',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='' WHERE clientid = null;
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('دونجا - مورد', 'دونجا - مورد', 'دونجا - مورد', 'دونجا - مورد', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 21:35:34'); -- id=631
UPDATE supplier SET suppliername = 'دونجا - مورد', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='631',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '148';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:05:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:35:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:35:34', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=sucess'); -- id=6862
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:05:35";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:35:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:35:35', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=show'); -- id=6863
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:05:36";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:35:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:35:36', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6864
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:05:52";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:35:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:35:52', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6865
BEGIN;
CALL supplierInUse(148,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('148', '0.00', '100000', '1', 'ايصال دفع لمورد', '1', '-100000', '2026-10-09 21:35:36', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','100000','1','0','0','0','51',''); -- id=352
UPDATE supplierdebtchange SET supplierid = '148', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '100000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-100000', supplierdebtchangedate = '2026-10-09 21:35:36', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='-100000', paySerialNo='51',tagids='' WHERE supplierdebtchangeid = '352';
UPDATE supplier SET  suppliercurrentDebt = '-100000',suppliercurrentDebtInCurrency= '-100000' , userid = '1', supplierdate = '2026-10-09 21:35:52'   WHERE supplierid = '148';
UPDATE supplier SET  inUse = 0 where supplierid = 148;
UPDATE save SET  savecurrentvalue = '-33967750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-33867750.00','100000', '1', '1', 'ايصال دفع لمورد', '352', '-33967750', '2026-10-09 21:35:52', '1',  'supplierPayedDeptController.php','0','','0'); -- id=470
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '100000', '100000', '2026-10-09', '1', '0', '0', '2026-10-09 21:35:52','ايصال دفع لمورد ( دونجا - مورد ) ','1','0','-1','0','352','supplierReportsController.php?do=show&id=352'); -- id=1964
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1964', '631', '100000', '','0'); -- id=1999
UPDATE accountstree SET name = 'دونجا - مورد', customName = 'دونجا - مورد', customNameEn = 'دونجا - مورد', nameEn = 'دونجا - مورد', parent = '81', accountNature = '1', theValue = '-100000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:35:34' WHERE id = '631';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1964', '383', '100000', '','0'); -- id=1966
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-33967750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '148', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '100000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-100000.00', supplierdebtchangedate = '2026-10-09 21:35:36', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1964',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='-100000', paySerialNo='51',tagids='' WHERE supplierdebtchangeid = '352';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:05:52";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:35:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:35:52', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6866
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:05:54";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:35:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:35:54', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6867
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:05:54";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:35:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:35:54', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6868
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:06:01";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:36:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:36:01', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6869
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:06:19";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:36:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:36:19', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6870
BEGIN;
CALL supplierInUse(130,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('130', '272580.00', '50000', '1', 'ايصال دفع لمورد', '1', '222580', '2026-10-09 21:36:01', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','50000','1','0','0','0','52',''); -- id=353
UPDATE supplierdebtchange SET supplierid = '130', supplierdebtchangebefore = '272580.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '222580', supplierdebtchangedate = '2026-10-09 21:36:01', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='272580',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='222580', paySerialNo='52',tagids='' WHERE supplierdebtchangeid = '353';
UPDATE supplier SET  suppliercurrentDebt = '222580',suppliercurrentDebtInCurrency= '222580' , userid = '1', supplierdate = '2026-10-09 21:36:19'   WHERE supplierid = '130';
UPDATE supplier SET  inUse = 0 where supplierid = 130;
UPDATE save SET  savecurrentvalue = '-34017750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-33967750.00','50000', '1', '1', 'ايصال دفع لمورد', '353', '-34017750', '2026-10-09 21:36:19', '1',  'supplierPayedDeptController.php','0','','0'); -- id=471
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 21:36:19','ايصال دفع لمورد ( ماتيجو ) ','1','0','-1','0','353','supplierReportsController.php?do=show&id=353'); -- id=1965
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1965', '613', '50000', '','0'); -- id=2000
UPDATE accountstree SET name = 'ماتيجو', customName = 'ماتيجو', customNameEn = 'ماتيجو', nameEn = 'ماتيجو', parent = '81', accountNature = '1', theValue = '222580', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 16:11:08' WHERE id = '613';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1965', '383', '50000', '','0'); -- id=1967
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-34017750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '130', supplierdebtchangebefore = '272580.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '222580.00', supplierdebtchangedate = '2026-10-09 21:36:01', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1965',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='272580',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='222580', paySerialNo='52',tagids='' WHERE supplierdebtchangeid = '353';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:06:20";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:36:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:36:20', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6871
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:06:21";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:36:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:36:21', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6872
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:06:21";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:36:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:36:21', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6873
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:06:26";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:36:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:36:26', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6874
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:06:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:36:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:36:34', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6875
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:06:44";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:36:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:36:44', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=add'); -- id=6876
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('ذا بست - مورد', '', '', '0', '', '0', '1', '2026-10-09 21:36:44', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=149
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 ('149', '0', '0', '0', 'إضافة مورد جديد', '149', '0', '2026-10-09 21:36:44', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=354
UPDATE client SET clientname = '', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '', clientdetails = '', conditions = null, clientdate = '', userid = null  , clientareaid = null  ,clientcode = '',dailyentryid = null , rondomtxt = '',clientStoreIds = '', obygyPatientId = '0' , debtLimit='0' , typeclientid='',priceTypeId='0',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '149',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='0',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='0',datecustomeraccount='',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='' WHERE clientid = null;
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('ذا بست - مورد', 'ذا بست - مورد', 'ذا بست - مورد', 'ذا بست - مورد', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 21:36:45'); -- id=632
UPDATE supplier SET suppliername = 'ذا بست - مورد', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='632',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '149';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:06:45";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:36:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:36:45', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=sucess'); -- id=6877
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:06:46";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:36:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:36:46', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=show'); -- id=6878
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:06:47";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:36:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:36:47', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6879
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:06:59";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:36:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:36:59', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6880
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:07:05";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:37:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:37:05', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6881
BEGIN;
CALL supplierInUse(149,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('149', '0.00', '50000', '1', 'ايصال دفع لمورد', '1', '-50000', '2026-10-09 21:36:47', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','50000','1','0','0','0','53',''); -- id=355
UPDATE supplierdebtchange SET supplierid = '149', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-50000', supplierdebtchangedate = '2026-10-09 21:36:47', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='-50000', paySerialNo='53',tagids='' WHERE supplierdebtchangeid = '355';
UPDATE supplier SET  suppliercurrentDebt = '-50000',suppliercurrentDebtInCurrency= '-50000' , userid = '1', supplierdate = '2026-10-09 21:37:05'   WHERE supplierid = '149';
UPDATE supplier SET  inUse = 0 where supplierid = 149;
UPDATE save SET  savecurrentvalue = '-34067750',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-34017750.00','50000', '1', '1', 'ايصال دفع لمورد', '355', '-34067750', '2026-10-09 21:37:05', '1',  'supplierPayedDeptController.php','0','','0'); -- id=472
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-09', '1', '0', '0', '2026-10-09 21:37:05','ايصال دفع لمورد ( ذا بست - مورد ) ','1','0','-1','0','355','supplierReportsController.php?do=show&id=355'); -- id=1966
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1966', '632', '50000', '','0'); -- id=2001
UPDATE accountstree SET name = 'ذا بست - مورد', customName = 'ذا بست - مورد', customNameEn = 'ذا بست - مورد', nameEn = 'ذا بست - مورد', parent = '81', accountNature = '1', theValue = '-50000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:36:45' WHERE id = '632';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1966', '383', '50000', '','0'); -- id=1968
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-34067750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '149', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-50000.00', supplierdebtchangedate = '2026-10-09 21:36:47', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1966',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='-50000', paySerialNo='53',tagids='' WHERE supplierdebtchangeid = '355';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:07:05";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:37:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:37:05', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6882
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:07:07";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:37:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:37:07', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6883
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:07:07";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:37:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:37:07', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6884
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:07:17";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:37:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:37:17', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6885
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:07:24";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:37:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:37:24', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6886
BEGIN;
CALL supplierInUse(15,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('15', '65122.00', '65122', '1', 'ايصال دفع لمورد', '1', '0', '2026-10-09 21:36:59', '1', 'supplierPayedDeptController.php', 'تصفير الحساب من احمد ', '0','1', '-1','1','1','65122','1','0','0','0','53',''); -- id=356
UPDATE supplierdebtchange SET supplierid = '15', supplierdebtchangebefore = '65122.00', supplierdebtchangeamount = '65122', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '0', supplierdebtchangedate = '2026-10-09 21:36:59', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'تصفير الحساب من احمد ', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='65122',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='65122',debtchangamountInSupplierCurrency='65122',debtchangafterInSupplierCurrency='0', paySerialNo='53',tagids='' WHERE supplierdebtchangeid = '356';
UPDATE supplier SET  suppliercurrentDebt = '0',suppliercurrentDebtInCurrency= '0' , userid = '1', supplierdate = '2026-10-09 21:37:24'   WHERE supplierid = '15';
UPDATE supplier SET  inUse = 0 where supplierid = 15;
UPDATE save SET  savecurrentvalue = '-34132872',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-34067750.00','65122', '1', '1', 'ايصال دفع لمورد', '356', '-34132872', '2026-10-09 21:37:24', '1',  'supplierPayedDeptController.php','0','','0'); -- id=473
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '65122', '65122', '2026-10-09', '1', '0', '0', '2026-10-09 21:37:24','ايصال دفع لمورد ( اباتشي - مورد ) ','1','0','0','0','356','supplierReportsController.php?do=show&id=356'); -- id=1967
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1967', '434', '65122', '','0'); -- id=2002
UPDATE accountstree SET name = 'اباتشي - مورد', customName = 'اباتشي - مورد', customNameEn = 'اباتشي - مورد', nameEn = 'اباتشي - مورد', parent = '81', accountNature = '1', theValue = '-189915', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '434';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1967', '383', '65122', '','0'); -- id=1969
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-34132872', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '15', supplierdebtchangebefore = '65122.00', supplierdebtchangeamount = '65122.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '0.00', supplierdebtchangedate = '2026-10-09 21:36:59', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'تصفير الحساب من احمد ', dailyentryid = '1967',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='65122',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='65122',debtchangamountInSupplierCurrency='65122',debtchangafterInSupplierCurrency='0', paySerialNo='53',tagids='' WHERE supplierdebtchangeid = '356';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:07:24";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:37:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:37:24', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6887
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:07:25";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:37:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:37:25', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6888
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:07:26";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:37:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:37:26', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6889
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:07:37";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:37:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:37:37', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6890
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:07:42";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:37:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsnewController.php', '2026-10-09 21:37:42', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsnewController.php'); -- id=6891
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:08:01";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:38:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:38:01', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6892
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:08:12";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:38:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:38:12', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=add'); -- id=6893
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('دارك - مورد', '', '', '0', '', '0', '1', '2026-10-09 21:38:12', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=150
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 ('150', '0', '0', '0', 'إضافة مورد جديد', '150', '0', '2026-10-09 21:38:12', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=357
UPDATE client SET clientname = '', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '', clientdetails = '', conditions = null, clientdate = '', userid = null  , clientareaid = null  ,clientcode = '',dailyentryid = null , rondomtxt = '',clientStoreIds = '', obygyPatientId = '0' , debtLimit='0' , typeclientid='',priceTypeId='0',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '150',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='0',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='0',datecustomeraccount='',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='' WHERE clientid = null;
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('دارك - مورد', 'دارك - مورد', 'دارك - مورد', 'دارك - مورد', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 21:38:12'); -- id=633
UPDATE supplier SET suppliername = 'دارك - مورد', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='633',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '150';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:08:12";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:38:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:38:12', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=sucess'); -- id=6894
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:08:14";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:38:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:38:14', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=show'); -- id=6895
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:08:20";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:38:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:38:20', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6896
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:09:39";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:39:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:39:39', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6897
BEGIN;
CALL supplierInUse(150,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('150', '0.00', '103755', '1', 'ايصال دفع لمورد', '1', '-103755', '2026-10-09 21:38:20', '1', 'supplierPayedDeptController.php', 'دفعة استفاح', '0','1', '-1','1','1','103755','1','0','0','0','54',''); -- id=358
UPDATE supplierdebtchange SET supplierid = '150', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '103755', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-103755', supplierdebtchangedate = '2026-10-09 21:38:20', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='103755',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='103755',debtchangafterInSupplierCurrency='-103755', paySerialNo='54',tagids='' WHERE supplierdebtchangeid = '358';
UPDATE supplier SET  suppliercurrentDebt = '-103755',suppliercurrentDebtInCurrency= '-103755' , userid = '1', supplierdate = '2026-10-09 21:39:39'   WHERE supplierid = '150';
UPDATE supplier SET  inUse = 0 where supplierid = 150;
UPDATE save SET  savecurrentvalue = '-34236627',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-34132872.00','103755', '1', '1', 'ايصال دفع لمورد', '358', '-34236627', '2026-10-09 21:39:39', '1',  'supplierPayedDeptController.php','0','','0'); -- id=474
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '103755', '103755', '2026-10-09', '1', '0', '0', '2026-10-09 21:39:39','ايصال دفع لمورد ( دارك - مورد ) ','1','0','-1','0','358','supplierReportsController.php?do=show&id=358'); -- id=1968
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1968', '633', '103755', '','0'); -- id=2003
UPDATE accountstree SET name = 'دارك - مورد', customName = 'دارك - مورد', customNameEn = 'دارك - مورد', nameEn = 'دارك - مورد', parent = '81', accountNature = '1', theValue = '-103755', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:38:12' WHERE id = '633';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1968', '383', '103755', '','0'); -- id=1970
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-34236627', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '150', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '103755.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-103755.00', supplierdebtchangedate = '2026-10-09 21:38:20', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'دفعة استفاح', dailyentryid = '1968',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='103755',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='0',debtchangamountInSupplierCurrency='103755',debtchangafterInSupplierCurrency='-103755', paySerialNo='54',tagids='' WHERE supplierdebtchangeid = '358';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:09:40";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:39:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:39:40', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6898
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:09:41";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:39:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:39:41', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6899
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:09:41";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:39:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:39:41', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6900
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:10:55";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:40:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:40:55', '1', 'oneSupplier', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=6901
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:11:20";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:41:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:41:20', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=6902
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:12:06";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:42:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:42:06', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=add'); -- id=6903
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('بروك - مورد', '', '', '0', '', '0', '1', '2026-10-09 21:42:06', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=151
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 ('151', '0', '0', '0', 'إضافة مورد جديد', '151', '0', '2026-10-09 21:42:06', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=359
UPDATE client SET clientname = '', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '', clientdetails = '', conditions = null, clientdate = '', userid = null  , clientareaid = null  ,clientcode = '',dailyentryid = null , rondomtxt = '',clientStoreIds = '', obygyPatientId = '0' , debtLimit='0' , typeclientid='',priceTypeId='0',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '151',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='0',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='0',datecustomeraccount='',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='' WHERE clientid = null;
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('بروك - مورد', 'بروك - مورد', 'بروك - مورد', 'بروك - مورد', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-09 21:42:06'); -- id=634
UPDATE supplier SET suppliername = 'بروك - مورد', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-09', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='634',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '151';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:12:07";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:42:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:42:07', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=sucess'); -- id=6904
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:12:08";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:42:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:42:08', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=show'); -- id=6905
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:14:01";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:44:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsnewController.php', '2026-10-09 21:44:01', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsnewController.php'); -- id=6906
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:14:08";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:44:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsnewController.php', '2026-10-09 21:44:08', '1', 'supplierShow2', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsnewController.php?do=supplierShow2'); -- id=6907
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:14:16";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:44:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:44:16', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=6908
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:14:42";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:44:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:44:42', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=6909
BEGIN;
CALL supplierInUse(13,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('13', '182525.00', '300000', '1', 'ايصال دفع لمورد', '1', '-117475', '2026-10-09 21:44:16', '1', 'supplierPayedDeptController.php', 'عدد 3 شيكات * 100 الف', '0','1', '-1','1','1','300000','1','0','0','0','55',''); -- id=360
UPDATE supplierdebtchange SET supplierid = '13', supplierdebtchangebefore = '182525.00', supplierdebtchangeamount = '300000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-117475', supplierdebtchangedate = '2026-10-09 21:44:16', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'عدد 3 شيكات * 100 الف', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='300000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='497124',debtchangamountInSupplierCurrency='300000',debtchangafterInSupplierCurrency='-117475', paySerialNo='55',tagids='' WHERE supplierdebtchangeid = '360';
UPDATE supplier SET  suppliercurrentDebt = '-117475',suppliercurrentDebtInCurrency= '-117475' , userid = '1', supplierdate = '2026-10-09 21:44:42'   WHERE supplierid = '13';
UPDATE supplier SET  inUse = 0 where supplierid = 13;
UPDATE save SET  savecurrentvalue = '-34536627',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-34236627.00','300000', '1', '1', 'ايصال دفع لمورد', '360', '-34536627', '2026-10-09 21:44:42', '1',  'supplierPayedDeptController.php','0','','0'); -- id=475
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '300000', '300000', '2026-10-09', '1', '0', '0', '2026-10-09 21:44:42','ايصال دفع لمورد ( كيميت اكس - مورد ) ','1','0','-1','0','360','supplierReportsController.php?do=show&id=360'); -- id=1969
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1969', '432', '300000', '','0'); -- id=2004
UPDATE accountstree SET name = 'كيميت اكس - مورد', customName = 'كيميت اكس - مورد', customNameEn = 'كيميت اكس - مورد', nameEn = 'كيميت اكس - مورد', parent = '81', accountNature = '1', theValue = '-348906', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '432';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1969', '383', '300000', '','0'); -- id=1971
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-34536627', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '13', supplierdebtchangebefore = '182525.00', supplierdebtchangeamount = '300000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-117475.00', supplierdebtchangedate = '2026-10-09 21:44:16', userid = '1', tablename = 'supplierPayedDeptController.php', comment = 'عدد 3 شيكات * 100 الف', dailyentryid = '1969',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='300000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='497124',debtchangamountInSupplierCurrency='300000',debtchangafterInSupplierCurrency='-117475', paySerialNo='55',tagids='' WHERE supplierdebtchangeid = '360';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:14:43";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:44:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:44:43', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=6910
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:14:44";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:44:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-09 21:44:44', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=6911
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:14:44";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:44:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-09 21:44:44', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=6912
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:15:35";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:45:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 21:45:35', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php'); -- id=6913
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:15:37";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:45:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-09 21:45:37', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=show'); -- id=6914
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:15:43";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:45:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 21:45:43', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=6915
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:19:01";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:49:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:49:01', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php'); -- id=6916
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:19:32";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:49:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:49:32', '1', 'add', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=add'); -- id=6917

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =504
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(15,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '367886' , clientdate = '2026-10-09 21:49:32', userid = '1' WHERE clientid = '15';
UPDATE client SET  inUse = 0 where clientid = 15;
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 ('15','407886.00','40000','1','ايصال تحصيل (( قبض من عميل ))','504', '367886', '2026-09-26  15:45:1', '1', 'clientPayedDeptController.php', '   ', '40000', '0', null, '0', null, null,'', '-1','1','1','40000','1','','486','0','','.'); -- id=504
UPDATE save SET  savecurrentvalue = '-34496627',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-34536627.00','40000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '504', '-34496627', '2026-10-09 21:49:32', '1',  'clientPayedDeptController.php','15','','0'); -- id=476
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '40000', '40000', '2026-10-09', '1', '0', '0', '2026-10-09 21:49:32','اضافة ايصال سداد للعميل سيف كوكو - العملاء','1','0','0','0','504','clientPayedDeptController.php?do=show&id=504'); -- id=1970
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1970', '383', '40000', '','0'); -- id=2005
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-34496627', 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 ('1970', '513', '40000', '','0'); -- id=1972
UPDATE accountstree SET name = 'سيف كوكو - العملاء', customName = 'سيف كوكو - العملاء', customNameEn = 'سيف كوكو - العملاء', nameEn = 'سيف كوكو - العملاء', parent = '58', accountNature = '0', theValue = '-40000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '513';
UPDATE clientdebtchange SET clientid = '15', clientdebtchangebefore = '407886.000', clientdebtchangeamount = '40000.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '504', clientdebtchangeafter = '367886.000', clientdebtchangedate = '2026-09-26 15:45:01', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '40000.000',discount='', reciptid='0', dailyentryid = '1970',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='40000',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '504';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:19:32";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:49:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:49:32', '1', 'sucess', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=6918
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:19:34";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 21:49:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-09 21:49:34', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=show'); -- id=6919
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:37:04";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:37:04";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:37:06";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 22:07:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 22:07:06', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6920
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:37:06";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 22:07:06', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6921
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:37:08";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 22:07:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 22:07:08', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php'); -- id=6922
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:37:09";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 22:07:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 22:07:09', '1', 'showallajax', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php?do=showallajax'); -- id=6923
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:37:12";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 22:07:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 22:07:12', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php'); -- id=6924
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:37:19";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 22:07:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 22:07:19', '1', 'showallajax', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php?do=showallajax'); -- id=6925
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:37:23";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 22:07:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-09 22:07:23', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientdebt.php'); -- id=6926
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:38:24";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 22:08:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 22:08:24', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php'); -- id=6927
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:38:30";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 22:08:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 22:08:30', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=6928
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:39:12";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 22:09:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 22:09:12', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php'); -- id=6929
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:39:24";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 22:09:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-09 22:09:24', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=6930
UPDATE user SET loginip = "" WHERE userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:53:26";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:53:26";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:53:29";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 22:23:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-09 22:23:29', '1', '', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=6931
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:53:29";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-09 22:23:29', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=6932
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-09 18:54:10";
UPDATE user SET loginip = "156.196.18.158", lastactivetime = "2026-10-09 22:24:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientController.php', '2026-10-09 22:24:10', '1', 'show', '156.196.18.158', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientController.php?do=show'); -- id=6933
